From e6fee257e68e7b145a47eee8c5937db7a7a99849 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 10 Jan 2019 16:44:31 +0100 Subject: Code generation for access to contract code. --- libsolidity/interface/CompilerStack.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libsolidity/interface/CompilerStack.cpp') diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index f9d889e7..fc33f755 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 compiledContracts; + map> otherCompilers; for (Source const* source: m_sourceOrder) for (ASTPointer const& node: source->ast->nodes()) if (auto contract = dynamic_cast(node.get())) if (isRequestedContract(*contract)) - compileContract(*contract, compiledContracts); + compileContract(*contract, otherCompilers); m_stackState = CompilationSuccessful; this->link(); return true; @@ -795,19 +795,19 @@ bool onlySafeExperimentalFeaturesActivated(set const& featu void CompilerStack::compileContract( ContractDefinition const& _contract, - map& _compiledContracts + map>& _otherCompilers ) { solAssert(m_stackState >= AnalysisSuccessful, ""); if ( - _compiledContracts.count(&_contract) || + _otherCompilers.count(&_contract) || !_contract.annotation().unimplementedFunctions.empty() || !_contract.constructorIsPublic() ) return; for (auto const* dependency: _contract.annotation().contractDependencies) - compileContract(*dependency, _compiledContracts); + compileContract(*dependency, _otherCompilers); Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); @@ -825,7 +825,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 +852,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 -- cgit v1.2.3 From a9fa2658d8690f18aa14c599a305cf59a5cd4e3c Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 17 Jan 2019 20:08:17 +0100 Subject: Add helper to show if contract can be deployed. --- libsolidity/interface/CompilerStack.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'libsolidity/interface/CompilerStack.cpp') diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index fc33f755..9e4da62d 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -800,11 +800,7 @@ void CompilerStack::compileContract( { solAssert(m_stackState >= AnalysisSuccessful, ""); - if ( - _otherCompilers.count(&_contract) || - !_contract.annotation().unimplementedFunctions.empty() || - !_contract.constructorIsPublic() - ) + if (_otherCompilers.count(&_contract) || !_contract.canBeDeployed()) return; for (auto const* dependency: _contract.annotation().contractDependencies) compileContract(*dependency, _otherCompilers); -- cgit v1.2.3