summaryrefslogtreecommitdiff
path: root/src/wasm-validator.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-13 12:38:44 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-13 12:38:44 -0700
commit22d10db3a9b04e5c225b0f472c07dba7ce9dc6d3 (patch)
treec38b3e8b4a7900d857583de9788b45ca1bfd8890 /src/wasm-validator.h
parent348565b6a9a823c0fee30c96d8d783810d540a78 (diff)
parent377f1f661d373afe5770d1ff0d3a4772a71ef893 (diff)
downloadbinaryen-22d10db3a9b04e5c225b0f472c07dba7ce9dc6d3.tar.gz
binaryen-22d10db3a9b04e5c225b0f472c07dba7ce9dc6d3.tar.bz2
binaryen-22d10db3a9b04e5c225b0f472c07dba7ce9dc6d3.zip
Merge pull request #493 from WebAssembly/error-improvements
Error handling improvements
Diffstat (limited to 'src/wasm-validator.h')
-rw-r--r--src/wasm-validator.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index 49e2eb5d8..7315ba4e5 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -71,8 +71,10 @@ public:
} else {
if (breakTypes[name] == unreachable) {
breakTypes[name] = valueType;
- } else {
- shouldBeEqual(valueType, breakTypes[name], name.str, "breaks to same target must have same type (ignoring unreachable)");
+ } else if (valueType != unreachable) {
+ if (valueType != breakTypes[name]) {
+ breakTypes[name] = none; // a poison value that must not be consumed
+ }
}
}
}
@@ -86,7 +88,9 @@ public:
noteBreak(curr->default_, curr->value);
}
void visitSetLocal(SetLocal *curr) {
- shouldBeEqual(curr->type, curr->value->type, curr, "set_local type must be correct");
+ if (curr->value->type != unreachable) {
+ shouldBeEqual(curr->type, curr->value->type, curr, "set_local type must be correct");
+ }
}
void visitLoad(Load *curr) {
validateAlignment(curr->align);
@@ -111,9 +115,9 @@ public:
case Trunc:
case Nearest:
case Sqrt: {
- //if (curr->value->type != unreachable) {
+ if (curr->value->type != unreachable) {
shouldBeEqual(curr->value->type, curr->type, curr, "non-conversion unaries must return the same type");
- //}
+ }
break;
}
case EqZ: {