diff options
Diffstat (limited to 'libjulia/backends/evm/EVMCodeTransform.h')
-rw-r--r-- | libjulia/backends/evm/EVMCodeTransform.h | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/libjulia/backends/evm/EVMCodeTransform.h b/libjulia/backends/evm/EVMCodeTransform.h index 202f5051..d09ee87b 100644 --- a/libjulia/backends/evm/EVMCodeTransform.h +++ b/libjulia/backends/evm/EVMCodeTransform.h @@ -21,6 +21,7 @@ #include <libjulia/backends/evm/EVMAssembly.h> #include <libsolidity/inlineasm/AsmScope.h> +#include <libsolidity/inlineasm/AsmDataForward.h> #include <boost/variant.hpp> #include <boost/optional.hpp> @@ -32,21 +33,6 @@ namespace solidity class ErrorReporter; namespace assembly { -struct Literal; -struct Block; -struct Switch; -struct Label; -struct FunctionalInstruction; -struct Assignment; -struct VariableDeclaration; -struct Instruction; -struct Identifier; -struct StackAssignment; -struct FunctionDefinition; -struct FunctionCall; - -using Statement = boost::variant<Instruction, Literal, Label, StackAssignment, Identifier, Assignment, FunctionCall, FunctionalInstruction, VariableDeclaration, FunctionDefinition, Switch, Block>; - struct AsmAnalysisInfo; } } @@ -75,9 +61,6 @@ public: { } - /// Processes the block and appends the resulting code to the assembly. - void run(solidity::assembly::Block const& _block); - protected: struct Context { @@ -115,6 +98,7 @@ public: void operator()(solidity::assembly::VariableDeclaration const& _varDecl); void operator()(solidity::assembly::Switch const& _switch); void operator()(solidity::assembly::FunctionDefinition const&); + void operator()(solidity::assembly::ForLoop const&); void operator()(solidity::assembly::Block const& _block); private: @@ -126,6 +110,12 @@ private: /// Generates code for an expression that is supposed to return a single value. void visitExpression(solidity::assembly::Statement const& _expression); + void visitStatements(std::vector<solidity::assembly::Statement> const& _statements); + + /// Pops all variables declared in the block and checks that the stack height is equal + /// to @a _blackStartStackHeight. + void finalizeBlock(solidity::assembly::Block const& _block, int _blockStartStackHeight); + void generateAssignment(solidity::assembly::Identifier const& _variableName); /// Determines the stack height difference to the given variables. Throws |