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.
This commit is contained in:
Rhett Aultman 2016-12-11 23:06:57 -08:00 committed by Rhett Aultman
parent 071b936b37
commit 8f25bd54e3

View File

@ -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;
}