summaryrefslogtreecommitdiff
path: root/src/wasm
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-08-01 13:35:18 -0700
committerGitHub <noreply@github.com>2022-08-01 13:35:18 -0700
commit0b288693cc74810278af9c4630fdb0d5fa7dd7bd (patch)
treeeec12469a6981c1d666ed1ca85221202f306de8e /src/wasm
parent67459642f1d3cfdb74190a83aa1228cfa7332ecd (diff)
downloadbinaryen-0b288693cc74810278af9c4630fdb0d5fa7dd7bd.tar.gz
binaryen-0b288693cc74810278af9c4630fdb0d5fa7dd7bd.tar.bz2
binaryen-0b288693cc74810278af9c4630fdb0d5fa7dd7bd.zip
Update reference type Literal constructors to use HeapType (#4857)
We already require non-null literals to have non-null types, but with this change we can enforce that constraint by construction. Also remove the default behavior of creating a function reference literal with heap type `func`, since there is always a more specific function type to use.
Diffstat (limited to 'src/wasm')
-rw-r--r--src/wasm/literal.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index 608018d8b..b8a6c7e7a 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -65,10 +65,8 @@ Literal::Literal(const uint8_t init[16]) : type(Type::v128) {
memcpy(&v128, init, 16);
}
-Literal::Literal(std::shared_ptr<GCData> gcData, Type type)
- : gcData(gcData), type(type) {
- // Null data is only allowed if nullable.
- assert(gcData || type.isNullable());
+Literal::Literal(std::shared_ptr<GCData> gcData, HeapType type)
+ : gcData(gcData), type(type, gcData ? NonNullable : Nullable) {
// The type must be a proper type for GC data.
assert(isData());
}