-fixed the warning printing

-style fixes
This commit is contained in:
LianaHus 2015-10-01 17:59:01 +02:00
parent 2706846f43
commit 53d0684cb4
4 changed files with 17 additions and 17 deletions

View File

@ -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;
}

View File

@ -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()))
{

View File

@ -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)

View File

@ -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;