summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-validator.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index d14a56a10..04c42e4f2 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -491,8 +491,8 @@ public:
if (curr->value) {
if (returnType == unreachable) {
returnType = curr->value->type;
- } else if (curr->value->type != unreachable && returnType != curr->value->type) {
- returnType = none; // poison
+ } else if (curr->value->type != unreachable) {
+ shouldBeEqual(curr->value->type, returnType, curr, "function results must match");
}
} else {
returnType = none;
@@ -560,10 +560,8 @@ public:
if (curr->body->type != unreachable) {
shouldBeEqual(curr->result, curr->body->type, curr->body, "function body type must match, if function returns");
}
- if (curr->result != none) { // TODO: over previous too?
- if (returnType != unreachable) {
- shouldBeEqual(curr->result, returnType, curr->body, "function result must match, if function returns");
- }
+ if (returnType != unreachable) {
+ shouldBeEqual(curr->result, returnType, curr->body, "function result must match, if function has returns");
}
returnType = unreachable;
labelNames.clear();