summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 0160ffaf6..386f89060 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -6893,11 +6893,14 @@ bool WasmBinaryBuilder::maybeVisitI31Get(Expression*& out, uint32_t code) {
}
bool WasmBinaryBuilder::maybeVisitRefTest(Expression*& out, uint32_t code) {
- if (code == BinaryConsts::RefTestStatic || code == BinaryConsts::RefTest) {
+ if (code == BinaryConsts::RefTestStatic || code == BinaryConsts::RefTest ||
+ code == BinaryConsts::RefTestNull) {
bool legacy = code == BinaryConsts::RefTestStatic;
- auto intendedType = legacy ? getIndexedHeapType() : getHeapType();
+ auto castType = legacy ? getIndexedHeapType() : getHeapType();
+ auto nullability =
+ (code == BinaryConsts::RefTestNull) ? Nullable : NonNullable;
auto* ref = popNonVoidExpression();
- out = Builder(wasm).makeRefTest(ref, intendedType);
+ out = Builder(wasm).makeRefTest(ref, Type(castType, nullability));
return true;
}
return false;