summaryrefslogtreecommitdiff
path: root/src/tools/wasm-shell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/wasm-shell.cpp')
-rw-r--r--src/tools/wasm-shell.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp
index 20d4b9344..b3b52d9a1 100644
--- a/src/tools/wasm-shell.cpp
+++ b/src/tools/wasm-shell.cpp
@@ -161,6 +161,7 @@ static void run_asserts(Name moduleName,
invalid = true;
};
ModuleUtils::iterImportedGlobals(wasm, reportUnknownImport);
+ ModuleUtils::iterImportedTables(wasm, reportUnknownImport);
ModuleUtils::iterImportedFunctions(wasm, [&](Importable* import) {
if (import->module == SPECTEST && import->base.startsWith(PRINT)) {
// We can handle it.
@@ -168,23 +169,22 @@ static void run_asserts(Name moduleName,
reportUnknownImport(import);
}
});
- if (wasm.memory.imported()) {
- reportUnknownImport(&wasm.memory);
- }
- if (wasm.table.imported()) {
- reportUnknownImport(&wasm.table);
- }
- for (auto& segment : wasm.table.segments) {
- for (auto name : segment.data) {
- // spec tests consider it illegal to use spectest.print in a table
- if (auto* import = wasm.getFunction(name)) {
- if (import->imported() && import->module == SPECTEST &&
- import->base.startsWith(PRINT)) {
- std::cerr << "cannot put spectest.print in table\n";
- invalid = true;
+ ModuleUtils::iterDefinedTables(wasm, [&](Table* table) {
+ for (auto& segment : table->segments) {
+ for (auto name : segment.data) {
+ // spec tests consider it illegal to use spectest.print in a table
+ if (auto* import = wasm.getFunction(name)) {
+ if (import->imported() && import->module == SPECTEST &&
+ import->base.startsWith(PRINT)) {
+ std::cerr << "cannot put spectest.print in table\n";
+ invalid = true;
+ }
}
}
}
+ });
+ if (wasm.memory.imported()) {
+ reportUnknownImport(&wasm.memory);
}
}
if (!invalid) {