diff options
author | Christian <c@ethdev.com> | 2014-10-31 05:52:15 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-31 21:37:23 +0800 |
commit | a36db1f2412d700cc8b32f8331be103c73ea90cb (patch) | |
tree | ccbf14d061fcbae162d361eaeaeffb036e50d743 /Compiler.cpp | |
parent | cb9cb48dc78240717cd4842e75c9314778ebcb10 (diff) | |
download | dexon-solidity-a36db1f2412d700cc8b32f8331be103c73ea90cb.tar.gz dexon-solidity-a36db1f2412d700cc8b32f8331be103c73ea90cb.tar.zst dexon-solidity-a36db1f2412d700cc8b32f8331be103c73ea90cb.zip |
Actual contract creator and add solidity to AlethZero interface.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index 7e40db15..b1e3c3da 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -46,9 +46,22 @@ void Compiler::compileContract(ContractDefinition& _contract) for (ASTPointer<FunctionDefinition> const& function: _contract.getDefinedFunctions()) m_context.addFunction(*function); + appendFunctionSelector(_contract.getDefinedFunctions()); for (ASTPointer<FunctionDefinition> const& function: _contract.getDefinedFunctions()) function->accept(*this); + + packIntoContractCreator(); +} + +void Compiler::packIntoContractCreator() +{ + CompilerContext creatorContext; + eth::AssemblyItem sub = creatorContext.addSubroutine(m_context.getAssembly()); + // stack contains sub size + creatorContext << eth::Instruction::DUP1 << sub << u256(0) << eth::Instruction::CODECOPY; + creatorContext << u256(0) << eth::Instruction::RETURN; + swap(m_context, creatorContext); } void Compiler::appendFunctionSelector(vector<ASTPointer<FunctionDefinition>> const& _functions) |