diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-06 20:00:21 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-11-14 18:29:16 +0800 |
commit | be70703f82d7ac0822ce518ca11acb7c34514b00 (patch) | |
tree | 912cc75a34b2d1c2e4d767c1a9fb51e2f732d6cb | |
parent | 5778af07a390f70692be927f3e9702f1725d78f4 (diff) | |
download | dexon-solidity-be70703f82d7ac0822ce518ca11acb7c34514b00.tar.gz dexon-solidity-be70703f82d7ac0822ce518ca11acb7c34514b00.tar.zst dexon-solidity-be70703f82d7ac0822ce518ca11acb7c34514b00.zip |
Move lastContractName closer to contractNames
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 889903f0..082a0939 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -353,6 +353,19 @@ vector<string> CompilerStack::contractNames() const return contractNames; } +string const CompilerStack::lastContractName() const +{ + if (m_contracts.empty()) + BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("No compiled contracts found.")); + // try to find some user-supplied contract + string contractName; + for (auto const& it: m_sources) + for (ASTPointer<ASTNode> const& node: it.second.ast->nodes()) + if (auto contract = dynamic_cast<ContractDefinition const*>(node.get())) + contractName = contract->fullyQualifiedName(); + return contractName; +} + eth::AssemblyItems const* CompilerStack::assemblyItems(string const& _contractName) const { Contract const& currentContract = contract(_contractName); @@ -760,19 +773,6 @@ void CompilerStack::compileContract( _compiledContracts[compiledContract.contract] = &compiler->assembly(); } -string const CompilerStack::lastContractName() const -{ - if (m_contracts.empty()) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_comment("No compiled contracts found.")); - // try to find some user-supplied contract - string contractName; - for (auto const& it: m_sources) - for (ASTPointer<ASTNode> const& node: it.second.ast->nodes()) - if (auto contract = dynamic_cast<ContractDefinition const*>(node.get())) - contractName = contract->fullyQualifiedName(); - return contractName; -} - CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const { if (m_contracts.empty()) |