diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-08-02 21:21:44 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-09-07 09:54:52 -0700 |
commit | 1cc33903a0b1b9dddd40674d792a59ee0d1bccf7 (patch) | |
tree | 28e9dc13c5e7531f2c2801601cddf09283a39a24 | |
parent | 9d27d6818f83308c4853e3d8870d5b88a374453f (diff) | |
download | binaryen-1cc33903a0b1b9dddd40674d792a59ee0d1bccf7.tar.gz binaryen-1cc33903a0b1b9dddd40674d792a59ee0d1bccf7.tar.bz2 binaryen-1cc33903a0b1b9dddd40674d792a59ee0d1bccf7.zip |
it is not cool to return a nop
-rw-r--r-- | src/passes/Print.cpp | 2 | ||||
-rw-r--r-- | src/wasm-validator.h | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index ac349abc7..4f6baa9da 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -481,7 +481,7 @@ struct PrintSExpression : public Visitor<PrintSExpression> { } void visitReturn(Return *curr) { printOpening(o, "return"); - if (!curr->value || curr->value->is<Nop>()) { + if (!curr->value) { // avoid a new line just for the parens o << ')'; return; diff --git a/src/wasm-validator.h b/src/wasm-validator.h index b4818e253..ca89270e9 100644 --- a/src/wasm-validator.h +++ b/src/wasm-validator.h @@ -283,6 +283,7 @@ public: void visitReturn(Return* curr) { if (curr->value) { + shouldBeFalse(curr->value->is<Nop>(), curr, "cannot return a nop"); if (returnType == unreachable) { returnType = curr->value->type; } else if (curr->value->type != unreachable && returnType != curr->value->type) { |