diff options
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index cf287d8a1..4fdc29a66 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -2776,9 +2776,15 @@ Expression* SExpressionWasmBuilder::makeI31Get(Element& s, bool signed_) { } Expression* SExpressionWasmBuilder::makeRefTest(Element& s) { - auto heapType = parseHeapType(*s[1]); - auto* ref = parseExpression(*s[2]); - return Builder(wasm).makeRefTest(ref, heapType); + int i = 1; + auto nullability = NonNullable; + if (s[0]->str().str != "ref.test_static" && s[1]->str().str == "null") { + nullability = Nullable; + ++i; + } + auto heapType = parseHeapType(*s[i++]); + auto* ref = parseExpression(*s[i++]); + return Builder(wasm).makeRefTest(ref, Type(heapType, nullability)); } Expression* SExpressionWasmBuilder::makeRefCast(Element& s) { |