From e8be0e61b395c61a836e018861cc3fdec10f6a8a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 5 Apr 2018 14:23:36 +0200 Subject: [PATCH] Catch FatalError in CompilerStack::analysis to cover all the analysis tests --- libsolidity/analysis/TypeChecker.cpp | 12 +----------- libsolidity/interface/CompilerStack.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index a252742d9..ce2771ca5 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -60,17 +60,7 @@ bool typeSupportedByOldABIEncoder(Type const& _type) bool TypeChecker::checkTypeRequirements(ASTNode const& _contract) { - try - { - _contract.accept(*this); - } - catch (FatalError const&) - { - // We got a fatal error which required to stop further type checking, but we can - // continue normally from here. - if (m_errorReporter.errors().empty()) - throw; // Something is weird here, rather throw again. - } + _contract.accept(*this); return Error::containsOnlyWarnings(m_errorReporter.errors()); } diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index eacfca9c8..e7cdb742b 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -164,6 +164,8 @@ bool CompilerStack::analyze() resolveImports(); bool noErrors = true; + + try { SyntaxChecker syntaxChecker(m_errorReporter); for (Source const* source: m_sourceOrder) if (!syntaxChecker.checkSyntax(*source->ast)) @@ -245,6 +247,14 @@ bool CompilerStack::analyze() smtChecker.analyze(*source->ast); } + } + catch(FatalError const&) + { + if (m_errorReporter.errors().empty()) + throw; // Something is weird here, rather throw again. + noErrors = false; + } + if (noErrors) { m_stackState = AnalysisSuccessful;