From 8f25bd54e35dba3fb632c2d209a86acaba63d33d Mon Sep 17 00:00:00 2001 From: Rhett Aultman Date: Sun, 11 Dec 2016 23:06:57 -0800 Subject: 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 ":", while the tests try to look it up under the name "". This change resolves that issue by dropping the ':' in cases where there is, effectively, no source file to prepend anyway. --- libsolidity/ast/AST.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libsolidity/ast') 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; } -- cgit v1.2.3