diff options
author | Rhett Aultman <roadriverrail@gmail.com> | 2016-12-16 20:22:42 +0800 |
---|---|---|
committer | Rhett Aultman <rhett.aultman@meraki.net> | 2017-01-17 01:32:57 +0800 |
commit | 0c98e4b2da6b5de885114a744339a1f0f96c79be (patch) | |
tree | 8a50d02f9d255c5e11836c39267c42d76b60fdeb /libsolidity | |
parent | 220ccfb492511eab5a45936e477e6882f52be96a (diff) | |
download | dexon-solidity-0c98e4b2da6b5de885114a744339a1f0f96c79be.tar.gz dexon-solidity-0c98e4b2da6b5de885114a744339a1f0f96c79be.tar.zst dexon-solidity-0c98e4b2da6b5de885114a744339a1f0f96c79be.zip |
Stylistic corrections
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/ast/AST.cpp | 2 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 12 |
2 files changed, 5 insertions, 9 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 562ac828..45ff69c5 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -190,7 +190,7 @@ void ContractDefinition::setUserDocumentation(Json::Value const& _userDocumentat } -std::string ContractDefinition::fullyQualifiedName() const +string ContractDefinition::fullyQualifiedName() const { std::string sourceString = *(location().sourceName); std::string qualifiedName = (sourceString.empty() ? ("") : (sourceString + ":")) + name(); diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 7626406c..fbaf1bcc 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -184,7 +184,7 @@ bool CompilerStack::parse() if (m_contracts.find(contract->fullyQualifiedName()) != m_contracts.end()) { - const ContractDefinition* existingContract = m_contracts.find(contract->fullyQualifiedName())->second.contract; + ContractDefinition const* existingContract = m_contracts[contract->fullyQualifiedName()].contract; if (contract != existingContract) { auto err = make_shared<Error>(Error::Type::DeclarationError); @@ -201,9 +201,7 @@ bool CompilerStack::parse() } } else - { m_contracts[contract->fullyQualifiedName()].contract = contract; - } } if (!checkLibraryNameClashes()) @@ -224,9 +222,10 @@ bool CompilerStack::parse() else noErrors = false; + // Note that find() must be used here to prevent an automatic insert into the map if (m_contracts.find(contract->fullyQualifiedName()) != m_contracts.end()) { - const ContractDefinition* existingContract = m_contracts.find(contract->fullyQualifiedName())->second.contract; + ContractDefinition const* existingContract = m_contracts[contract->fullyQualifiedName()].contract; if (contract != existingContract) { @@ -245,9 +244,7 @@ bool CompilerStack::parse() } else - { m_contracts[contract->fullyQualifiedName()].contract = contract; - } } if (noErrors) @@ -379,8 +376,7 @@ std::string const CompilerStack::filesystemFriendlyName(string const& _contractN } } // If no collision, return the contract's name - // String is copied to ensure that the contract's name can't be messed with - return std::string(matchContract.contract->name()); + return matchContract.contract->name(); } eth::LinkerObject const& CompilerStack::object(string const& _contractName) const |