diff options
Diffstat (limited to 'src/wasm-validator.h')
-rw-r--r-- | src/wasm-validator.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h index fad33a081..04493bb5b 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -104,6 +104,7 @@ public: shouldBeFalse(top > curr->initial); } void visitModule(Module *curr) { + // exports for (auto& exp : curr->exports) { Name name = exp->name; bool found = false; @@ -115,6 +116,14 @@ public: } shouldBeTrue(found); } + // start + if (curr->start.is()) { + auto iter = curr->functionsMap.find(curr->start); + if (shouldBeTrue(iter != curr->functionsMap.end())) { + auto func = iter->second; + shouldBeTrue(func->params.size() == 0); // must be nullary + } + } } private: @@ -135,11 +144,13 @@ private: // helpers - void shouldBeTrue(bool result) { + bool shouldBeTrue(bool result) { if (!result) valid = false; + return result; } - void shouldBeFalse(bool result) { + bool shouldBeFalse(bool result) { if (result) valid = false; + return result; } void validateAlignment(size_t align) { |