diff options
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r-- | src/wasm/wasm-s-parser.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 41a0619f9..78ac84f42 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -3027,9 +3027,14 @@ Expression* SExpressionWasmBuilder::makeArraySet(Element& s) { } Expression* SExpressionWasmBuilder::makeArrayLen(Element& s) { - // Ignore the type annotation and don't bother validating it. - parseHeapType(*s[1]); - auto ref = parseExpression(*s[2]); + // There may or may not be a type annotation. + Index i = 1; + try { + parseHeapType(*s[i]); + ++i; + } catch (...) { + } + auto ref = parseExpression(*s[i]); return Builder(wasm).makeArrayLen(ref); } |