summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h
index 3f61b113f..a4dd60532 100644
--- a/src/wasm-s-parser.h
+++ b/src/wasm-s-parser.h
@@ -1472,7 +1472,11 @@ private:
wasm.addGlobal(global.release());
}
+ bool seenTable = false;
+
void parseTable(Element& s) {
+ seenTable = true;
+
if (s.size() == 1) return; // empty table in old notation
if (!s[1]->dollared()) {
if (s[1]->str() == ANYFUNC) {
@@ -1495,6 +1499,7 @@ private:
}
void parseElem(Element& s) {
+ if (!seenTable) throw ParseException("elem without table", s.line, s.col);
Index i = 1;
Expression* offset;
if (s[i]->isList()) {