aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-26 01:38:15 +0800
committerGitHub <noreply@github.com>2017-08-26 01:38:15 +0800
commit372279ceb29b032cb977eeeb5df4c9495aebd206 (patch)
tree7933738c7a55f64c2f600364ce4f7ba0892f1bc5 /libsolidity
parent9e90ddcae5dd7fb6eb70e49f978979979cf39985 (diff)
parent8bc76ecf58b3e57ccfbc69da5e9633bae490ca92 (diff)
downloaddexon-solidity-372279ceb29b032cb977eeeb5df4c9495aebd206.tar.gz
dexon-solidity-372279ceb29b032cb977eeeb5df4c9495aebd206.tar.zst
dexon-solidity-372279ceb29b032cb977eeeb5df4c9495aebd206.zip
Merge pull request #2819 from ethereum/compilerstack-typecheck
Simplify typechecking loop in compilerstack
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/CompilerStack.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index 363f45dd..7e4518b9 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -188,6 +188,9 @@ bool CompilerStack::analyze()
if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
if (!resolver.resolveNamesAndTypes(*contract)) return false;
+ contract->setDevDocumentation(Natspec::devDocumentation(*contract));
+ contract->setUserDocumentation(Natspec::userDocumentation(*contract));
+
// Note that we now reference contracts by their fully qualified names, and
// thus contracts can only conflict if declared in the same source file. This
// already causes a double-declaration error elsewhere, so we do not report
@@ -197,30 +200,13 @@ bool CompilerStack::analyze()
m_contracts[contract->fullyQualifiedName()].contract = contract;
}
+ TypeChecker typeChecker(m_errorReporter);
for (Source const* source: m_sourceOrder)
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
- {
- m_globalContext->setCurrentContract(*contract);
- resolver.updateDeclaration(*m_globalContext->currentThis());
- TypeChecker typeChecker(m_errorReporter);
- if (typeChecker.checkTypeRequirements(*contract))
- {
- contract->setDevDocumentation(Natspec::devDocumentation(*contract));
- contract->setUserDocumentation(Natspec::userDocumentation(*contract));
- }
- else
+ if (!typeChecker.checkTypeRequirements(*contract))
noErrors = false;
- // Note that we now reference contracts by their fully qualified names, and
- // thus contracts can only conflict if declared in the same source file. This
- // already causes a double-declaration error elsewhere, so we do not report
- // an error here and instead silently drop any additional contracts we find.
-
- if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
- m_contracts[contract->fullyQualifiedName()].contract = contract;
- }
-
if (noErrors)
{
PostTypeChecker postTypeChecker(m_errorReporter);