From f8228e8ab116799a1b28ea9cbb01fdd7342b395c Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 9 Dec 2015 17:35:20 +0100 Subject: Relative paths in import directives. --- libsolidity/analysis/NameAndTypeResolver.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 907d703c..ca866ddb 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -71,19 +71,25 @@ bool NameAndTypeResolver::performImports(SourceUnit& _sourceUnit, map(node.get())) { - if (!_sourceUnits.count(imp->identifier())) + string const& path = imp->annotation().absolutePath; + if (!_sourceUnits.count(path)) { - reportDeclarationError(node->location(), "Import \"" + imp->identifier() + "\" not found."); + reportDeclarationError( node->location(), + "Import \"" + + path + + "\" (referenced as \"" + + imp->identifier() + + "\") not found." + ); error = true; } else { - auto scope = m_scopes.find(_sourceUnits.at(imp->identifier())); + auto scope = m_scopes.find(_sourceUnits.at(path)); solAssert(scope != end(m_scopes), ""); for (auto const& nameAndDeclaration: scope->second->declarations()) for (auto const& declaration: nameAndDeclaration.second) target.registerDeclaration(*declaration, &nameAndDeclaration.first); - } } return !error; -- cgit