diff options
Diffstat (limited to 'libjulia/backends')
-rw-r--r-- | libjulia/backends/evm/EVMCodeTransform.cpp | 13 | ||||
-rw-r--r-- | libjulia/backends/evm/EVMCodeTransform.h | 1 |
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&); |