summaryrefslogtreecommitdiff
path: root/src/wasm-binary.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-binary.h')
-rw-r--r--src/wasm-binary.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 954521365..decac5564 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -842,12 +842,10 @@ public:
if (debug) std::cerr << "zz node: Break" << std::endl;
if (curr->value) {
recurse(curr->value);
- } else {
- visitNop(nullptr);
}
if (curr->condition) recurse(curr->condition);
o << int8_t(curr->condition ? BinaryConsts::BrIf : BinaryConsts::Br)
- << U32LEB(getBreakIndex(curr->name));
+ << U32LEB(curr->value ? 1 : 0) << U32LEB(getBreakIndex(curr->name));
}
void visitSwitch(Switch *curr) {
if (debug) std::cerr << "zz node: Switch" << std::endl;
@@ -1730,9 +1728,11 @@ public:
void visitBreak(Break *curr, uint8_t code) {
if (debug) std::cerr << "zz node: Break" << std::endl;
+ auto arity = getU32LEB();
+ assert(arity == 0 || arity == 1);
curr->name = getBreakName(getU32LEB());
if (code == BinaryConsts::BrIf) curr->condition = popExpression();
- curr->value = popExpression();
+ if (arity == 1) curr->value = popExpression();
}
void visitSwitch(Switch *curr) {
if (debug) std::cerr << "zz node: Switch" << std::endl;