summaryrefslogtreecommitdiff
path: root/src/wasm-validator.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-validator.h')
-rw-r--r--src/wasm-validator.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index 866c1c3db..e9ce5911d 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -39,6 +39,7 @@
#include <set>
+#include "support/colors.h"
#include "wasm.h"
#include "wasm-printing.h"
@@ -213,7 +214,7 @@ public:
}
void visitCall(Call *curr) {
if (!validateGlobally) return;
- auto* target = getModule()->checkFunction(curr->target);
+ auto* target = getModule()->getFunctionOrNull(curr->target);
if (!shouldBeTrue(!!target, curr, "call target must exist")) return;
if (!shouldBeTrue(curr->operands.size() == target->params.size(), curr, "call param number must match")) return;
for (size_t i = 0; i < curr->operands.size(); i++) {
@@ -224,7 +225,7 @@ public:
}
void visitCallImport(CallImport *curr) {
if (!validateGlobally) return;
- auto* import = getModule()->checkImport(curr->target);
+ auto* import = getModule()->getImportOrNull(curr->target);
if (!shouldBeTrue(!!import, curr, "call_import target must exist")) return;
if (!shouldBeTrue(!!import->functionType.is(), curr, "called import must be function")) return;
auto* type = getModule()->getFunctionType(import->functionType);
@@ -237,7 +238,7 @@ public:
}
void visitCallIndirect(CallIndirect *curr) {
if (!validateGlobally) return;
- auto* type = getModule()->checkFunctionType(curr->fullType);
+ auto* type = getModule()->getFunctionTypeOrNull(curr->fullType);
if (!shouldBeTrue(!!type, curr, "call_indirect type must exist")) return;
shouldBeEqualOrFirstIsUnreachable(curr->target->type, i32, curr, "indirect call target must be an i32");
if (!shouldBeTrue(curr->operands.size() == type->params.size(), curr, "call param number must match")) return;
@@ -477,7 +478,7 @@ public:
}
shouldBeTrue(found, name, "module function exports must be found");
} else if (exp->kind == ExternalKind::Global) {
- shouldBeTrue(curr->checkGlobal(name), name, "module global exports must be found");
+ shouldBeTrue(curr->getGlobalOrNull(name), name, "module global exports must be found");
} else if (exp->kind == ExternalKind::Table) {
shouldBeTrue(name == Name("0") || name == curr->table.name, name, "module table exports must be found");
} else if (exp->kind == ExternalKind::Memory) {
@@ -491,7 +492,7 @@ public:
}
// start
if (curr->start.is()) {
- auto func = curr->checkFunction(curr->start);
+ auto func = curr->getFunctionOrNull(curr->start);
if (shouldBeTrue(func != nullptr, curr->start, "start must be found")) {
shouldBeTrue(func->params.size() == 0, curr, "start must have 0 params");
shouldBeTrue(func->result == none, curr, "start must not return a value");