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.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 91d4c129c..41a0619f9 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1194,6 +1194,9 @@ Type SExpressionWasmBuilder::stringToType(std::string_view str,
(str.substr(0, 9) == "structref" && (prefix || str.size() == 9))) {
return Type(HeapType::data, Nullable);
}
+ if (str.substr(0, 8) == "arrayref" && (prefix || str.size() == 8)) {
+ return Type(HeapType::array, Nullable);
+ }
if (str.substr(0, 9) == "stringref" && (prefix || str.size() == 9)) {
return Type(HeapType::string, Nullable);
}
@@ -1243,6 +1246,9 @@ HeapType SExpressionWasmBuilder::stringToHeapType(std::string_view str,
(str.substr(0, 6) == "struct" && (prefix || str.size() == 6))) {
return HeapType::data;
}
+ if (str.substr(0, 5) == "array" && (prefix || str.size() == 5)) {
+ return HeapType::array;
+ }
if (str.substr(0, 6) == "string" && (prefix || str.size() == 6)) {
return HeapType::string;
}
@@ -3021,9 +3027,9 @@ Expression* SExpressionWasmBuilder::makeArraySet(Element& s) {
}
Expression* SExpressionWasmBuilder::makeArrayLen(Element& s) {
- auto heapType = parseHeapType(*s[1]);
+ // Ignore the type annotation and don't bother validating it.
+ parseHeapType(*s[1]);
auto ref = parseExpression(*s[2]);
- validateHeapTypeUsingChild(ref, heapType, s);
return Builder(wasm).makeArrayLen(ref);
}