From 3730f68d4b856ba66d2ccf117800c4441e204a99 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 5 Apr 2018 14:25:51 +0200 Subject: reindent --- libsolidity/interface/CompilerStack.cpp | 139 ++++++++++++++++---------------- 1 file changed, 69 insertions(+), 70 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index e7cdb742..4ff14aa2 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -166,87 +166,86 @@ bool CompilerStack::analyze() bool noErrors = true; try { - SyntaxChecker syntaxChecker(m_errorReporter); - for (Source const* source: m_sourceOrder) - if (!syntaxChecker.checkSyntax(*source->ast)) - noErrors = false; - - DocStringAnalyser docStringAnalyser(m_errorReporter); - for (Source const* source: m_sourceOrder) - if (!docStringAnalyser.analyseDocStrings(*source->ast)) - noErrors = false; - - m_globalContext = make_shared(); - NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter); - for (Source const* source: m_sourceOrder) - if (!resolver.registerDeclarations(*source->ast)) - return false; - - map sourceUnitsByName; - for (auto& source: m_sources) - sourceUnitsByName[source.first] = source.second.ast.get(); - for (Source const* source: m_sourceOrder) - if (!resolver.performImports(*source->ast, sourceUnitsByName)) - return false; - - for (Source const* source: m_sourceOrder) - for (ASTPointer const& node: source->ast->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - { - m_globalContext->setCurrentContract(*contract); - if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false; - if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false; - if (!resolver.resolveNamesAndTypes(*contract)) return 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; - } - - TypeChecker typeChecker(m_evmVersion, m_errorReporter); - for (Source const* source: m_sourceOrder) - for (ASTPointer const& node: source->ast->nodes()) - if (ContractDefinition* contract = dynamic_cast(node.get())) - if (!typeChecker.checkTypeRequirements(*contract)) - noErrors = false; - - if (noErrors) - { - PostTypeChecker postTypeChecker(m_errorReporter); + SyntaxChecker syntaxChecker(m_errorReporter); for (Source const* source: m_sourceOrder) - if (!postTypeChecker.check(*source->ast)) + if (!syntaxChecker.checkSyntax(*source->ast)) noErrors = false; - } - if (noErrors) - { - StaticAnalyzer staticAnalyzer(m_errorReporter); + DocStringAnalyser docStringAnalyser(m_errorReporter); for (Source const* source: m_sourceOrder) - if (!staticAnalyzer.analyze(*source->ast)) + if (!docStringAnalyser.analyseDocStrings(*source->ast)) noErrors = false; - } - if (noErrors) - { - vector> ast; + m_globalContext = make_shared(); + NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter); for (Source const* source: m_sourceOrder) - ast.push_back(source->ast); + if (!resolver.registerDeclarations(*source->ast)) + return false; - if (!ViewPureChecker(ast, m_errorReporter).check()) - noErrors = false; - } + map sourceUnitsByName; + for (auto& source: m_sources) + sourceUnitsByName[source.first] = source.second.ast.get(); + for (Source const* source: m_sourceOrder) + if (!resolver.performImports(*source->ast, sourceUnitsByName)) + return false; - if (noErrors) - { - SMTChecker smtChecker(m_errorReporter, m_smtQuery); for (Source const* source: m_sourceOrder) - smtChecker.analyze(*source->ast); - } + for (ASTPointer const& node: source->ast->nodes()) + if (ContractDefinition* contract = dynamic_cast(node.get())) + { + m_globalContext->setCurrentContract(*contract); + if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false; + if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false; + if (!resolver.resolveNamesAndTypes(*contract)) return 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; + } + + TypeChecker typeChecker(m_evmVersion, m_errorReporter); + for (Source const* source: m_sourceOrder) + for (ASTPointer const& node: source->ast->nodes()) + if (ContractDefinition* contract = dynamic_cast(node.get())) + if (!typeChecker.checkTypeRequirements(*contract)) + noErrors = false; + if (noErrors) + { + PostTypeChecker postTypeChecker(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (!postTypeChecker.check(*source->ast)) + noErrors = false; + } + + if (noErrors) + { + StaticAnalyzer staticAnalyzer(m_errorReporter); + for (Source const* source: m_sourceOrder) + if (!staticAnalyzer.analyze(*source->ast)) + noErrors = false; + } + + if (noErrors) + { + vector> ast; + for (Source const* source: m_sourceOrder) + ast.push_back(source->ast); + + if (!ViewPureChecker(ast, m_errorReporter).check()) + noErrors = false; + } + + if (noErrors) + { + SMTChecker smtChecker(m_errorReporter, m_smtQuery); + for (Source const* source: m_sourceOrder) + smtChecker.analyze(*source->ast); + } } catch(FatalError const&) { -- cgit