From d5c54e9107efe76f3f63e716527efef2ea58c482 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 25 Apr 2019 11:34:56 +0200 Subject: [PATCH] [Yul] Catch fatal errors in analysis. --- libyul/AsmAnalysis.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index f8135dd38..f08023440 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -51,12 +51,21 @@ set const builtinTypes{"bool", "u8", "s8", "u32", "s32", "u64", "s64", " bool AsmAnalyzer::analyze(Block const& _block) { - if (!(ScopeFiller(m_info, m_errorReporter))(_block)) - return false; + bool success = false; + try + { + if (!(ScopeFiller(m_info, m_errorReporter))(_block)) + return false; - bool success = (*this)(_block); - if (!success) - solAssert(m_errorReporter.hasErrors(), "No success but no error."); + success = (*this)(_block); + if (!success) + solAssert(m_errorReporter.hasErrors(), "No success but no error."); + } + catch (FatalError const&) + { + // This FatalError con occur if the errorReporter has too many errors. + solAssert(!m_errorReporter.errors().empty(), "Fatal error detected, but no error is reported."); + } return success && !m_errorReporter.hasErrors(); }