aboutsummaryrefslogtreecommitdiffstats
path: root/libjulia
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-11-21 20:36:41 +0800
committerchriseth <chris@ethereum.org>2017-11-22 23:25:24 +0800
commit6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92 (patch)
treec7e5c438ef7517293c08f4e0516f8c38c9a7c5c6 /libjulia
parentff229ab05a43d113bcd2de79f25caf52017c3486 (diff)
downloaddexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar.gz
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar.bz2
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar.lz
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar.xz
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.tar.zst
dexon-solidity-6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92.zip
If statement for Iulia / inline assembly.
Diffstat (limited to 'libjulia')
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.cpp13
-rw-r--r--libjulia/backends/evm/EVMCodeTransform.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/libjulia/backends/evm/EVMCodeTransform.cpp b/libjulia/backends/evm/EVMCodeTransform.cpp
index 66f593e8..13d9d011 100644
--- a/libjulia/backends/evm/EVMCodeTransform.cpp
+++ b/libjulia/backends/evm/EVMCodeTransform.cpp
@@ -217,6 +217,19 @@ void CodeTransform::operator()(assembly::Instruction const& _instruction)
checkStackHeight(&_instruction);
}
+void CodeTransform::operator()(If const& _if)
+{
+ visitExpression(*_if.condition);
+ m_assembly.setSourceLocation(_if.location);
+ m_assembly.appendInstruction(solidity::Instruction::ISZERO);
+ AbstractAssembly::LabelID end = m_assembly.newLabelId();
+ m_assembly.appendJumpToIf(end);
+ (*this)(_if.body);
+ m_assembly.setSourceLocation(_if.location);
+ m_assembly.appendLabel(end);
+ checkStackHeight(&_if);
+}
+
void CodeTransform::operator()(Switch const& _switch)
{
//@TODO use JUMPV in EVM1.5?
diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h
index 951c8a50..387720a2 100644
--- a/libjulia/backends/evm/EVMCodeTransform.h
+++ b/libjulia/backends/evm/EVMCodeTransform.h
@@ -104,6 +104,7 @@ public:
void operator()(solidity::assembly::StackAssignment const& _assignment);
void operator()(solidity::assembly::Assignment const& _assignment);
void operator()(solidity::assembly::VariableDeclaration const& _varDecl);
+ void operator()(solidity::assembly::If const& _if);
void operator()(solidity::assembly::Switch const& _switch);
void operator()(solidity::assembly::FunctionDefinition const&);
void operator()(solidity::assembly::ForLoop const&);