mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
reindent
This commit is contained in:
parent
e8be0e61b3
commit
3730f68d4b
@ -166,87 +166,86 @@ bool CompilerStack::analyze()
|
|||||||
bool noErrors = true;
|
bool noErrors = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SyntaxChecker syntaxChecker(m_errorReporter);
|
SyntaxChecker syntaxChecker(m_errorReporter);
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
if (!syntaxChecker.checkSyntax(*source->ast))
|
if (!syntaxChecker.checkSyntax(*source->ast))
|
||||||
noErrors = false;
|
noErrors = false;
|
||||||
|
|
||||||
DocStringAnalyser docStringAnalyser(m_errorReporter);
|
DocStringAnalyser docStringAnalyser(m_errorReporter);
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
if (!docStringAnalyser.analyseDocStrings(*source->ast))
|
if (!docStringAnalyser.analyseDocStrings(*source->ast))
|
||||||
noErrors = false;
|
noErrors = false;
|
||||||
|
|
||||||
m_globalContext = make_shared<GlobalContext>();
|
m_globalContext = make_shared<GlobalContext>();
|
||||||
NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter);
|
NameAndTypeResolver resolver(m_globalContext->declarations(), m_scopes, m_errorReporter);
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
if (!resolver.registerDeclarations(*source->ast))
|
if (!resolver.registerDeclarations(*source->ast))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
map<string, SourceUnit const*> sourceUnitsByName;
|
map<string, SourceUnit const*> sourceUnitsByName;
|
||||||
for (auto& source: m_sources)
|
for (auto& source: m_sources)
|
||||||
sourceUnitsByName[source.first] = source.second.ast.get();
|
sourceUnitsByName[source.first] = source.second.ast.get();
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
if (!resolver.performImports(*source->ast, sourceUnitsByName))
|
if (!resolver.performImports(*source->ast, sourceUnitsByName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
|
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
|
||||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||||
{
|
{
|
||||||
m_globalContext->setCurrentContract(*contract);
|
m_globalContext->setCurrentContract(*contract);
|
||||||
if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false;
|
if (!resolver.updateDeclaration(*m_globalContext->currentThis())) return false;
|
||||||
if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
|
if (!resolver.updateDeclaration(*m_globalContext->currentSuper())) return false;
|
||||||
if (!resolver.resolveNamesAndTypes(*contract)) return false;
|
if (!resolver.resolveNamesAndTypes(*contract)) return false;
|
||||||
|
|
||||||
// Note that we now reference contracts by their fully qualified names, and
|
// 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
|
// 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
|
// already causes a double-declaration error elsewhere, so we do not report
|
||||||
// an error here and instead silently drop any additional contracts we find.
|
// an error here and instead silently drop any additional contracts we find.
|
||||||
|
|
||||||
if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
|
if (m_contracts.find(contract->fullyQualifiedName()) == m_contracts.end())
|
||||||
m_contracts[contract->fullyQualifiedName()].contract = contract;
|
m_contracts[contract->fullyQualifiedName()].contract = contract;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeChecker typeChecker(m_evmVersion, m_errorReporter);
|
TypeChecker typeChecker(m_evmVersion, m_errorReporter);
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
|
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
|
||||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||||
if (!typeChecker.checkTypeRequirements(*contract))
|
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;
|
noErrors = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (noErrors)
|
if (noErrors)
|
||||||
{
|
{
|
||||||
PostTypeChecker postTypeChecker(m_errorReporter);
|
StaticAnalyzer staticAnalyzer(m_errorReporter);
|
||||||
for (Source const* source: m_sourceOrder)
|
for (Source const* source: m_sourceOrder)
|
||||||
if (!postTypeChecker.check(*source->ast))
|
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;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (noErrors)
|
||||||
|
{
|
||||||
|
SMTChecker smtChecker(m_errorReporter, m_smtQuery);
|
||||||
|
for (Source const* source: m_sourceOrder)
|
||||||
|
smtChecker.analyze(*source->ast);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(FatalError const&)
|
catch(FatalError const&)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user