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.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index cc8fe2273..af042bd55 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1393,12 +1393,15 @@ Type SExpressionWasmBuilder::elementToType(Element& s) {
}
return Type(parseHeapType(*s[i]), nullable);
}
- // It's a tuple.
- std::vector<Type> types;
- for (size_t i = 0; i < s.size(); ++i) {
- types.push_back(elementToType(*list[i]));
+ if (elementStartsWith(s, TUPLE)) {
+ // It's a tuple.
+ std::vector<Type> types;
+ for (size_t i = 1; i < s.size(); ++i) {
+ types.push_back(elementToType(*list[i]));
+ }
+ return Type(types);
}
- return Type(types);
+ throw SParseException(std::string("expected type, got list"), s);
}
Type SExpressionWasmBuilder::stringToLaneType(const char* str) {