aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-12-05 10:09:47 +0800
committerchriseth <c@ethdev.com>2015-12-10 02:09:24 +0800
commit7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879 (patch)
treed6ac5e5fe041afc29dcea2aafa97d60dca82a991 /libsolidity/interface/CompilerStack.cpp
parente510e7e7929326de3a556d6d2e66b8b4376af7a9 (diff)
downloaddexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.tar.gz
dexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.tar.zst
dexon-solidity-7cb7818ceaf8f2e50cdd66b33a4e0d17c2a0e879.zip
Source units are independent scopes.
Diffstat (limited to 'libsolidity/interface/CompilerStack.cpp')
-rw-r--r--libsolidity/interface/CompilerStack.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 18eec0a2..38fe5956 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -103,12 +103,14 @@ bool CompilerStack::parse()
m_errors.clear();
m_parseSuccessful = false;
+ map<string, SourceUnit const*> sourceUnitsByName;
for (auto& sourcePair: m_sources)
{
sourcePair.second.scanner->reset();
sourcePair.second.ast = Parser(m_errors).parse(sourcePair.second.scanner);
if (!sourcePair.second.ast)
solAssert(!Error::containsOnlyWarnings(m_errors), "Parser returned null but did not report error.");
+ sourceUnitsByName[sourcePair.first] = sourcePair.second.ast.get();
}
if (!Error::containsOnlyWarnings(m_errors))
// errors while parsing. sould stop before type checking
@@ -129,6 +131,10 @@ bool CompilerStack::parse()
return false;
for (Source const* source: m_sourceOrder)
+ if (!resolver.performImports(*source->ast, sourceUnitsByName))
+ return false;
+
+ for (Source const* source: m_sourceOrder)
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{