diff options
author | Christian <c@ethdev.com> | 2014-10-31 01:15:25 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-31 04:21:25 +0800 |
commit | cb9cb48dc78240717cd4842e75c9314778ebcb10 (patch) | |
tree | 1da710c3f44a0b6d2c7735b23a9da006ad016ec3 /Compiler.h | |
parent | a5f360273896973a99ad696a427726da875d0473 (diff) | |
download | dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.gz dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.bz2 dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.lz dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.xz dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.zst dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.zip |
Function selector and variable (un)packing.
Diffstat (limited to 'Compiler.h')
-rw-r--r-- | Compiler.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -20,6 +20,7 @@ * Solidity AST to EVM bytecode compiler. */ +#include <ostream> #include <libsolidity/ASTVisitor.h> #include <libsolidity/CompilerContext.h> @@ -29,14 +30,20 @@ namespace solidity { class Compiler: private ASTVisitor { public: + Compiler(): m_returnTag(m_context.newTag()) {} + + void compileContract(ContractDefinition& _contract); + bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } + void streamAssembly(std::ostream& _stream) const { m_context.streamAssembly(_stream); } + /// Compile the given contract and return the EVM bytecode. static bytes compile(ContractDefinition& _contract); private: - Compiler(): m_returnTag(m_context.newTag()) {} - - void compileContract(ContractDefinition& _contract); - void appendFunctionSelector(const std::vector<ASTPointer<FunctionDefinition> >& _functions); + void appendFunctionSelector(std::vector<ASTPointer<FunctionDefinition> > const& _functions); + void appendFunctionCallSection(FunctionDefinition const& _function); + void appendCalldataUnpacker(FunctionDefinition const& _function); + void appendReturnValuePacker(FunctionDefinition const& _function); virtual bool visit(FunctionDefinition& _function) override; virtual bool visit(IfStatement& _ifStatement) override; @@ -47,7 +54,6 @@ private: virtual bool visit(VariableDefinition& _variableDefinition) override; virtual bool visit(ExpressionStatement& _expressionStatement) override; - bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } CompilerContext m_context; std::vector<eth::AssemblyItem> m_breakTags; ///< tag to jump to for a "break" statement |