summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp38
1 files changed, 4 insertions, 34 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index e30901c5b..d4dd99c2c 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -2854,44 +2854,14 @@ Expression* SExpressionWasmBuilder::makeI31Get(Element& s, bool signed_) {
}
Expression* SExpressionWasmBuilder::makeRefTest(Element& s) {
- int i = 1;
- Type castType;
- if (s[i]->isList() ||
- !(s[i]->dollared() ||
- stringToType(s[i]->str(), true /* allowError */) == Type::none)) {
- castType = elementToType(*s[i++]);
- } else {
- // legacy syntax
- auto nullability = NonNullable;
- if (s[1]->str().str == "null") {
- nullability = Nullable;
- ++i;
- }
- auto type = parseHeapType(*s[i++]);
- castType = Type(type, nullability);
- }
- auto* ref = parseExpression(*s[i++]);
+ Type castType = elementToType(*s[1]);
+ auto* ref = parseExpression(*s[2]);
return Builder(wasm).makeRefTest(ref, castType);
}
Expression* SExpressionWasmBuilder::makeRefCast(Element& s) {
- int i = 1;
- Type castType;
- if (s[i]->isList() ||
- !(s[i]->dollared() ||
- stringToType(s[i]->str(), true /* allowError */) == Type::none)) {
- castType = elementToType(*s[i++]);
- } else {
- // legacy syntax
- Nullability nullability = NonNullable;
- if (s[i]->str().str == "null") {
- nullability = Nullable;
- ++i;
- }
- auto type = parseHeapType(*s[i++]);
- castType = Type(type, nullability);
- }
- auto* ref = parseExpression(*s[i++]);
+ Type castType = elementToType(*s[1]);
+ auto* ref = parseExpression(*s[2]);
return Builder(wasm).makeRefCast(ref, castType);
}