diff options
author | chriseth <c@ethdev.com> | 2015-08-01 01:23:31 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-08-01 01:23:31 +0800 |
commit | 943fd623e16829ad93c05b60b44676485b989620 (patch) | |
tree | 2fb06c27db50f9f533261e424f1c531f6849d94d /Compiler.h | |
parent | f2f1e0300793ea5686a4ad1c5c46b9e454c01bdc (diff) | |
download | dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar.gz dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar.bz2 dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar.lz dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar.xz dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.tar.zst dexon-solidity-943fd623e16829ad93c05b60b44676485b989620.zip |
Create and output clone contracts.
Diffstat (limited to 'Compiler.h')
-rw-r--r-- | Compiler.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -44,6 +44,12 @@ public: void compileContract(ContractDefinition const& _contract, std::map<ContractDefinition const*, bytes const*> const& _contracts); + /// Compiles a contract that uses CALLCODE to call into a pre-deployed version of the given + /// contract at runtime, but contains the full creation-time code. + void compileClone( + ContractDefinition const& _contract, + std::map<ContractDefinition const*, bytes const*> const& _contracts + ); bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } bytes getRuntimeBytecode() { return m_context.getAssembledRuntimeBytecode(m_runtimeSub); } /// @arg _sourceCodes is the map of input files to source code strings @@ -68,6 +74,8 @@ private: /// Adds the code that is run at creation time. Should be run after exchanging the run-time context /// with a new and initialized context. Adds the constructor code. void packIntoContractCreator(ContractDefinition const& _contract, CompilerContext const& _runtimeContext); + /// Appends state variable initialisation and constructor code. + void appendInitAndConstructorCode(ContractDefinition const& _contract); void appendBaseConstructor(FunctionDefinition const& _constructor); void appendConstructor(FunctionDefinition const& _constructor); void appendFunctionSelector(ContractDefinition const& _contract); @@ -103,6 +111,9 @@ private: virtual bool visit(ExpressionStatement const& _expressionStatement) override; virtual bool visit(PlaceholderStatement const&) override; + /// Repeatedly visits all function which are referenced but which are not compiled yet. + void appendFunctionsWithoutCode(); + /// Appends one layer of function modifier code of the current function, or the function /// body itself if the last modifier was reached. void appendModifierOrFunctionCode(); @@ -110,6 +121,9 @@ private: void appendStackVariableInitialisation(VariableDeclaration const& _variable); void compileExpression(Expression const& _expression, TypePointer const& _targetType = TypePointer()); + /// @returns the runtime assembly for clone contracts. + static eth::Assembly getCloneRuntime(); + bool const m_optimize; unsigned const m_optimizeRuns; CompilerContext m_context; |