mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
-fixed the warning printing
-style fixes
This commit is contained in:
parent
2706846f43
commit
53d0684cb4
@ -122,6 +122,7 @@ bool CompilerStack::parse()
|
||||
}
|
||||
|
||||
InterfaceHandler interfaceHandler;
|
||||
bool typesFine = true;
|
||||
for (Source const* source: m_sourceOrder)
|
||||
for (ASTPointer<ASTNode> const& node: source->ast->nodes())
|
||||
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
|
||||
@ -129,14 +130,14 @@ bool CompilerStack::parse()
|
||||
m_globalContext->setCurrentContract(*contract);
|
||||
resolver.updateDeclaration(*m_globalContext->currentThis());
|
||||
TypeChecker typeChecker;
|
||||
bool typesFine = typeChecker.checkTypeRequirements(*contract);
|
||||
if (!typesFine)
|
||||
m_errors += typeChecker.errors();
|
||||
if (!typeChecker.checkTypeRequirements(*contract))
|
||||
typesFine = false;
|
||||
m_errors += typeChecker.errors();
|
||||
contract->setDevDocumentation(interfaceHandler.devDocumentation(*contract));
|
||||
contract->setUserDocumentation(interfaceHandler.userDocumentation(*contract));
|
||||
m_contracts[contract->name()].contract = contract;
|
||||
}
|
||||
m_parseSuccessful = m_errors.empty();
|
||||
m_parseSuccessful = typesFine;
|
||||
return m_parseSuccessful;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
|
||||
if (m_errors.empty())
|
||||
throw; // Something is weird here, rather throw again.
|
||||
}
|
||||
bool success = m_errors.empty();
|
||||
bool success = true;
|
||||
for (auto const& it: m_errors)
|
||||
if (!dynamic_cast<Warning const*>(it.get()))
|
||||
{
|
||||
|
@ -491,16 +491,15 @@ bool CommandLineInterface::processInput()
|
||||
// TODO: Perhaps we should not compile unless requested
|
||||
bool optimize = m_args.count("optimize") > 0;
|
||||
unsigned runs = m_args["optimize-runs"].as<unsigned>();
|
||||
if (!m_compiler->compile(optimize, runs))
|
||||
{
|
||||
for (auto const& error: m_compiler->errors())
|
||||
SourceReferenceFormatter::printExceptionInformation(
|
||||
cerr,
|
||||
*error,
|
||||
(dynamic_pointer_cast<Warning const>(error)) ? "Warning" : "Error", *m_compiler
|
||||
);
|
||||
bool successful = m_compiler->compile(optimize, runs);
|
||||
for (auto const& error: m_compiler->errors())
|
||||
SourceReferenceFormatter::printExceptionInformation(
|
||||
cerr,
|
||||
*error,
|
||||
(dynamic_pointer_cast<Warning const>(error)) ? "Warning" : "Error", *m_compiler
|
||||
);
|
||||
if (!successful)
|
||||
return false;
|
||||
}
|
||||
m_compiler->link(m_libraries);
|
||||
}
|
||||
catch (ParserError const& _exception)
|
||||
|
@ -45,7 +45,7 @@ namespace
|
||||
{
|
||||
|
||||
pair<ASTPointer<SourceUnit>, shared_ptr<Exception const>>
|
||||
parseAnalyseAndReturnError(string const& _source, bool _warning = false)
|
||||
parseAnalyseAndReturnError(string const& _source, bool _reportWarnings = false)
|
||||
{
|
||||
Parser parser;
|
||||
ASTPointer<SourceUnit> sourceUnit;
|
||||
@ -76,12 +76,12 @@ parseAnalyseAndReturnError(string const& _source, bool _warning = false)
|
||||
{
|
||||
for (auto const& firstError: typeChecker.errors())
|
||||
{
|
||||
if (!dynamic_pointer_cast<Warning const>(firstError))
|
||||
if (_reportWarnings || !dynamic_pointer_cast<Warning const>(firstError))
|
||||
{
|
||||
err = firstError;
|
||||
break;
|
||||
}
|
||||
else if (_warning)
|
||||
else if (_reportWarnings)
|
||||
{
|
||||
err = firstError;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user