diff options
author | chriseth <c@ethdev.com> | 2015-12-10 00:35:20 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-12-10 02:21:02 +0800 |
commit | f8228e8ab116799a1b28ea9cbb01fdd7342b395c (patch) | |
tree | 182796217c88cdfa49b2dedf3c192f75dd7a8052 /libsolidity/analysis | |
parent | 7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879 (diff) | |
download | dexon-solidity-f8228e8ab116799a1b28ea9cbb01fdd7342b395c.tar.gz dexon-solidity-f8228e8ab116799a1b28ea9cbb01fdd7342b395c.tar.zst dexon-solidity-f8228e8ab116799a1b28ea9cbb01fdd7342b395c.zip |
Relative paths in import directives.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/NameAndTypeResolver.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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<string, So for (auto const& node: _sourceUnit.nodes()) if (auto imp = dynamic_cast<ImportDirective const*>(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; |