diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-03-07 17:03:38 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-03-07 18:27:29 -0800 |
commit | 284ae677cca8794a464f9bf702e3ec6aace6c65b (patch) | |
tree | be323dc8b38ebe8cfe758c7df8ad2865f3f2bd7d /src/passes/Print.cpp | |
parent | ea3a9db4a071292d4e976ef36f4c197a9e8a5fea (diff) | |
download | binaryen-284ae677cca8794a464f9bf702e3ec6aace6c65b.tar.gz binaryen-284ae677cca8794a464f9bf702e3ec6aace6c65b.tar.bz2 binaryen-284ae677cca8794a464f9bf702e3ec6aace6c65b.zip |
br_table, no more cases
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index e8e917a6e..91c4040f6 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -125,29 +125,16 @@ struct PrintSExpression : public WasmVisitor<PrintSExpression, void> { decIndent(); } void visitSwitch(Switch *curr) { - printOpening(o, "tableswitch "); - if (curr->name.is()) o << curr->name; - incIndent(); - printFullLine(curr->value); - doIndent(o, indent) << "(table"; - std::set<Name> caseNames; - for (auto& c : curr->cases) { - caseNames.insert(c.name); - } + printOpening(o, "br_table"); for (auto& t : curr->targets) { - o << maybeSpace << "(" << (caseNames.count(t) == 0 ? "br" : "case") << " " << (t.is() ? t : curr->default_) << ")"; + o << " " << t; } - o << ")"; - if (curr->default_.is()) o << " (" << (caseNames.count(curr->default_) == 0 ? "br" : "case") << " " << curr->default_ << ")"; - o << maybeNewLine; - for (auto& c : curr->cases) { - doIndent(o, indent); - printMinorOpening(o, "case ") << c.name; - incIndent(); - printFullLine(c.body); - decIndent(); - o << maybeNewLine; + o << " " << curr->default_; + incIndent(); + if (curr->value) { + printFullLine(curr->value); } + printFullLine(curr->condition); decIndent(); } |