[Yul] Catch fatal errors in analysis.

This commit is contained in:
chriseth 2019-04-25 11:34:56 +02:00
parent 6292adbde6
commit d5c54e9107

View File

@ -51,12 +51,21 @@ set<string> 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();
}