summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-s-parser.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index d6df7ab0f..c7cedfdbd 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -3737,10 +3737,13 @@ void SExpressionWasmBuilder::parseImport(Element& s) {
table->max = Table::kUnlimitedSize;
}
- wasm.addTable(std::move(table));
-
- j++; // funcref
// ends with the table element type
+ table->type = elementToType(*inner[j++]);
+ if (!table->type.isRef()) {
+ throw SParseException("Only reference types are valid for tables", s);
+ }
+
+ wasm.addTable(std::move(table));
} else if (kind == ExternalKind::Memory) {
auto memory = std::make_unique<Memory>();
memory->setName(name, hasExplicitName);