From 6dbc34e16ee8bda0e156ccb20a3fb8cb6ff52c92 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 21 Nov 2017 13:36:41 +0100 Subject: If statement for Iulia / inline assembly. --- libjulia/backends/evm/EVMCodeTransform.cpp | 13 +++++++++++++ libjulia/backends/evm/EVMCodeTransform.h | 1 + 2 files changed, 14 insertions(+) (limited to 'libjulia') 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&); -- cgit v1.2.3