summaryrefslogtreecommitdiff
path: root/src/wasm.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-20 09:58:10 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-20 09:58:10 -0800
commitb974e9351405880fe1d021e3ae7fda92f1b3bb4f (patch)
treee5f2b9fb512a3adf649516f54adc60bb9584272c /src/wasm.h
parent39891e0c123103ceef18150c9d1145924dced2bf (diff)
downloadbinaryen-b974e9351405880fe1d021e3ae7fda92f1b3bb4f.tar.gz
binaryen-b974e9351405880fe1d021e3ae7fda92f1b3bb4f.tar.bz2
binaryen-b974e9351405880fe1d021e3ae7fda92f1b3bb4f.zip
br_if
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 {