diff options
author | chriseth <chris@ethereum.org> | 2019-01-18 07:16:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 07:16:06 +0800 |
commit | 2ec997e697e306dd54165aad365406ee88c534cb (patch) | |
tree | 5e943e23d38e332de3eedd33be11f2cf9df5fd69 /libsolidity/interface/CompilerStack.cpp | |
parent | 0711873a2f13d7b0f27e268fcd0a7683665f339d (diff) | |
parent | 2a92403690a4998ab097503231ac39f854b9c76c (diff) | |
download | dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar.gz dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar.bz2 dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar.lz dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar.xz dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.tar.zst dexon-solidity-2ec997e697e306dd54165aad365406ee88c534cb.zip |
Merge pull request #5775 from ethereum/codeAccess
Provide access to code of contract types.
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index f9d889e7..9e4da62d 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -343,12 +343,12 @@ bool CompilerStack::compile() return false; // Only compile contracts individually which have been requested. - map<ContractDefinition const*, eth::Assembly const*> compiledContracts; + map<ContractDefinition const*, shared_ptr<Compiler const>> otherCompilers; for (Source const* source: m_sourceOrder) for (ASTPointer<ASTNode> const& node: source->ast->nodes()) if (auto contract = dynamic_cast<ContractDefinition const*>(node.get())) if (isRequestedContract(*contract)) - compileContract(*contract, compiledContracts); + compileContract(*contract, otherCompilers); m_stackState = CompilationSuccessful; this->link(); return true; @@ -795,19 +795,15 @@ bool onlySafeExperimentalFeaturesActivated(set<ExperimentalFeature> const& featu void CompilerStack::compileContract( ContractDefinition const& _contract, - map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts + map<ContractDefinition const*, shared_ptr<Compiler const>>& _otherCompilers ) { solAssert(m_stackState >= AnalysisSuccessful, ""); - if ( - _compiledContracts.count(&_contract) || - !_contract.annotation().unimplementedFunctions.empty() || - !_contract.constructorIsPublic() - ) + if (_otherCompilers.count(&_contract) || !_contract.canBeDeployed()) return; for (auto const* dependency: _contract.annotation().contractDependencies) - compileContract(*dependency, _compiledContracts); + compileContract(*dependency, _otherCompilers); Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); @@ -825,7 +821,7 @@ void CompilerStack::compileContract( try { // Run optimiser and compile the contract. - compiler->compileContract(_contract, _compiledContracts, cborEncodedMetadata); + compiler->compileContract(_contract, _otherCompilers, cborEncodedMetadata); } catch(eth::OptimizerException const&) { @@ -852,7 +848,7 @@ void CompilerStack::compileContract( solAssert(false, "Assembly exception for deployed bytecode"); } - _compiledContracts[compiledContract.contract] = &compiler->assembly(); + _otherCompilers[compiledContract.contract] = compiler; } CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const |