summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm.h')
-rw-r--r--src/wasm.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/wasm.h b/src/wasm.h
index 49951c14a..eb4d69fd4 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -392,14 +392,22 @@ public:
class Break : public Expression {
public:
- Break() : Expression(BreakId), value(nullptr) {}
+ Break() : Expression(BreakId), condition(nullptr), value(nullptr) {}
+ Expression *condition;
Name name;
Expression *value;
std::ostream& doPrint(std::ostream &o, unsigned indent) {
- printOpening(o, "br ") << name;
- incIndent(o, indent);
+ if (condition) {
+ printOpening(o, "br_if");
+ incIndent(o, indent);
+ printFullLine(o, indent, condition);
+ doIndent(o, indent) << name << '\n';
+ } else {
+ printOpening(o, "br ") << name;
+ incIndent(o, indent);
+ }
if (value) printFullLine(o, indent, value);
return decIndent(o, indent);
}
@@ -1261,6 +1269,7 @@ struct WasmWalker : public WasmVisitor<void> {
}
void visitLabel(Label *curr) override {}
void visitBreak(Break *curr) override {
+ parent.walk(curr->condition);
parent.walk(curr->value);
}
void visitSwitch(Switch *curr) override {