summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-20 10:48:10 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-20 10:48:10 -0700
commita2f3fbdc80b72fcf04a789e723de7f5561387dcc (patch)
tree0919805194011cc453e7074030dc15c1342f67c3 /src
parente9c7c20ef84fc5a66823b9fa871f54f98a8a714a (diff)
downloadbinaryen-a2f3fbdc80b72fcf04a789e723de7f5561387dcc.tar.gz
binaryen-a2f3fbdc80b72fcf04a789e723de7f5561387dcc.tar.bz2
binaryen-a2f3fbdc80b72fcf04a789e723de7f5561387dcc.zip
type check return types fully
Diffstat (limited to 'src')
-rw-r--r--src/wasm-validator.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index 893306897..a19071959 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -206,7 +206,13 @@ public:
void visitReturn(Return* curr) {
if (curr->value) {
- returnType = curr->value->type;
+ if (returnType == unreachable) {
+ returnType = curr->value->type;
+ } else if (curr->value->type != unreachable && returnType != curr->value->type) {
+ returnType = none; // poison
+ }
+ } else {
+ returnType = none;
}
}