diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 1a9d0104c..c72bbf01d 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -587,7 +587,7 @@ bool DeclarationRegistrationHelper::visit(ImportDirective& _import) solAssert(!!importee, ""); if (!m_scopes[importee]) m_scopes[importee] = make_shared(importee, nullptr, m_scopes[nullptr].get()); - // TODO here, m_selfNode inside the contanier does not point to the key of m_scopes (_import) - is that a problem? + // TODO here, m_selfNode inside the container does not point to the key of m_scopes (_import) - is that a problem? m_scopes[&_import] = m_scopes[importee]; ASTVisitor::visit(_import); return false; // Do not recurse into child nodes (Identifier for symbolAliases) diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index 602e7dda6..944142362 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -77,7 +77,7 @@ #include #include -#include "solstdlib.h" +#include #include @@ -352,9 +352,6 @@ bool CompilerStack::parse() Parser parser{m_errorReporter, m_evmVersion, m_parserErrorRecovery}; - for (auto [name, content]: solidity::solstdlib::sources) - m_sources[name].charStream = make_unique(content, name); - vector sourcesToParse; for (auto const& s: m_sources) sourcesToParse.push_back(s.first); @@ -374,6 +371,14 @@ bool CompilerStack::parse() { solAssert(!import->path().empty(), "Import path cannot be empty."); + auto it = solidity::solstdlib::sources.find(import->path()); + if (it != solidity::solstdlib::sources.end()) + { + auto [name, content] = *it; + m_sources[name].charStream = make_unique(content, name); + sourcesToParse.push_back(name); + } + // The current value of `path` is the absolute path as seen from this source file. // We first have to apply remappings before we can store the actual absolute path // as seen globally. @@ -1166,7 +1171,6 @@ StringMap CompilerStack::loadMissingSources(SourceUnit const& _ast) if (ImportDirective const* import = dynamic_cast(node.get())) { string const& importPath = *import->annotation().absolutePath; - if (m_sources.count(importPath) || newSources.count(importPath)) continue;