diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-05 20:25:51 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-06 19:52:19 +0800 |
commit | 3730f68d4b856ba66d2ccf117800c4441e204a99 (patch) | |
tree | 35c87b61998aa265382d25a84c3d49788907635d | |
parent | e8be0e61b395c61a836e018861cc3fdec10f6a8a (diff) | |
download | dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar.gz dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar.bz2 dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar.lz dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar.xz dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.tar.zst dexon-solidity-3730f68d4b856ba66d2ccf117800c4441e204a99.zip |
reindent
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 139 |
1 files changed, 69 insertions, 70 deletions
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<GlobalContext>(); - NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter); - for (Source const* source: m_sourceOrder) - if (!resolver.registerDeclarations(*source->ast)) - return false; - - map<string, SourceUnit const*> 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<ASTNode> const& node: source->ast->nodes()) - if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(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<ASTNode> const& node: source->ast->nodes()) - if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(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<ASTPointer<ASTNode>> ast; + m_globalContext = make_shared<GlobalContext>(); + 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<string, SourceUnit const*> 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<ASTNode> const& node: source->ast->nodes()) + if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(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<ASTNode> const& node: source->ast->nodes()) + if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(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<ASTPointer<ASTNode>> 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&) { |