diff options
-rw-r--r-- | src/wasm-binary.h | 2 | ||||
-rw-r--r-- | src/wasm.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index be0d11e0a..08be2019a 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1570,7 +1570,7 @@ public: readExpression(curr->ifTrue); readExpression(curr->ifFalse); readExpression(curr->condition); - curr->type = curr->ifTrue->type; + curr->finalize(); } bool maybeVisitImpl(Host *curr, uint8_t code) { switch (code) { diff --git a/src/wasm.h b/src/wasm.h index 94c3cbdaa..5b56cd62d 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -851,6 +851,11 @@ public: printFullLine(o, indent, ifFalse); return decIndent(o, indent); } + + void finalize() { + type = ifTrue->type; + if (type == none) type = ifFalse->type; // ifTrue might be unreachable + } }; class Host : public Expression { |