aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmPrinter.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-04-28 21:27:56 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-26 10:16:09 +0800
commitb5080860d5f2d141b8fccceaa635378a86c996a8 (patch)
treea68c289d101e5f4d3a990da2e8c7608bb4f0fcbc /libsolidity/inlineasm/AsmPrinter.cpp
parentaf2d2499c1ccd431f5ac9455c2cbb63d3891f9b0 (diff)
downloaddexon-solidity-b5080860d5f2d141b8fccceaa635378a86c996a8.tar.gz
dexon-solidity-b5080860d5f2d141b8fccceaa635378a86c996a8.tar.zst
dexon-solidity-b5080860d5f2d141b8fccceaa635378a86c996a8.zip
Implement switch statement in the assembly parser/printer
Diffstat (limited to 'libsolidity/inlineasm/AsmPrinter.cpp')
-rw-r--r--libsolidity/inlineasm/AsmPrinter.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsolidity/inlineasm/AsmPrinter.cpp b/libsolidity/inlineasm/AsmPrinter.cpp
index 92b12423..92200f84 100644
--- a/libsolidity/inlineasm/AsmPrinter.cpp
+++ b/libsolidity/inlineasm/AsmPrinter.cpp
@@ -167,6 +167,20 @@ string AsmPrinter::operator()(assembly::FunctionCall const& _functionCall)
")";
}
+string AsmPrinter::operator()(Switch const& _switch)
+{
+ string out = "switch " + boost::apply_visitor(*this, *_switch.expression);
+ for (auto const& _case: _switch.cases)
+ {
+ if (_case.name.empty())
+ out += "\ndefault: ";
+ else
+ out += "\ncase " + _case.name + ": ";
+ out += (*this)(_case.body);
+ }
+ return out;
+}
+
string AsmPrinter::operator()(Block const& _block)
{
if (_block.statements.empty())