aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsolidity/CompilerStack.cpp9
-rw-r--r--libsolidity/TypeChecker.cpp2
-rw-r--r--solc/CommandLineInterface.cpp17
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp6
4 files changed, 17 insertions, 17 deletions
diff --git a/libsolidity/CompilerStack.cpp b/libsolidity/CompilerStack.cpp
index e6b87264..6ee19d58 100644
--- a/libsolidity/CompilerStack.cpp
+++ b/libsolidity/CompilerStack.cpp
@@ -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;
}
diff --git a/libsolidity/TypeChecker.cpp b/libsolidity/TypeChecker.cpp
index ec60373c..48a8a536 100644
--- a/libsolidity/TypeChecker.cpp
+++ b/libsolidity/TypeChecker.cpp
@@ -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()))
{
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index e3c7620e..be10faa8 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -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)
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index ad7b59ce..961c10b4 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -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;