diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm-binary.h | 6 | ||||
-rw-r--r-- | src/wasm.h | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 6b2e960d4..0b8663497 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -607,6 +607,11 @@ public: abort(); } if (curr->condition) recurse(curr->condition); + if (curr->value) { + recurse(curr->value); + } else { + o << int8_t(BinaryConsts::Nop); + } } void visitSwitch(Switch *curr) { if (debug) std::cerr << "zz node: Switch" << std::endl; @@ -1267,6 +1272,7 @@ public: auto offset = getInt8(); curr->name = breakStack[breakStack.size() - 1 - offset]; if (code == BinaryConsts::BrIf) readExpression(curr->condition); + readExpression(curr->value); } void visitSwitch(Switch *curr) { if (debug) std::cerr << "zz node: Switch" << std::endl; diff --git a/src/wasm.h b/src/wasm.h index 8a3ceac7c..9edd7645e 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -432,14 +432,14 @@ public: doIndent(o, indent) << name << '\n'; } else { printOpening(o, "br ") << name; - if (!value) { + if (!value || value->is<Nop>()) { // avoid a new line just for the parens o << ")"; return o; } incIndent(o, indent); } - if (value) printFullLine(o, indent, value); + if (value && !value->is<Nop>()) printFullLine(o, indent, value); return decIndent(o, indent); } }; |