aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorRhett Aultman <roadriverrail@gmail.com>2016-12-12 15:06:57 +0800
committerRhett Aultman <rhett.aultman@meraki.net>2017-01-17 01:32:57 +0800
commit8f25bd54e35dba3fb632c2d209a86acaba63d33d (patch)
treed807179523d3922623859a7dab241e2bcbd3678a /libsolidity/ast
parent071b936b371cd5287717d0ac27b80b837836809a (diff)
downloaddexon-solidity-8f25bd54e35dba3fb632c2d209a86acaba63d33d.tar.gz
dexon-solidity-8f25bd54e35dba3fb632c2d209a86acaba63d33d.tar.zst
dexon-solidity-8f25bd54e35dba3fb632c2d209a86acaba63d33d.zip
Drop ':' if the source file name is empty
A large number of tests compile contracts while passing in an empty string for the source name. This leads to it being keyed by the name ":<contract>", while the tests try to look it up under the name "<contract>". This change resolves that issue by dropping the ':' in cases where there is, effectively, no source file to prepend anyway.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/AST.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index 480fce44..562ac828 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -192,7 +192,8 @@ void ContractDefinition::setUserDocumentation(Json::Value const& _userDocumentat
std::string ContractDefinition::fullyQualifiedName() const
{
- std::string qualifiedName = *(location().sourceName) + ":" + name();
+ std::string sourceString = *(location().sourceName);
+ std::string qualifiedName = (sourceString.empty() ? ("") : (sourceString + ":")) + name();
return qualifiedName;
}