Skip to content

Commit

Permalink
Assert presence of errors in case of FatalError instead of rethrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Jun 12, 2024
1 parent 19b4370 commit 1adb032
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions libsolidity/analysis/NameAndTypeResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ bool NameAndTypeResolver::registerDeclarations(SourceUnit& _sourceUnit, ASTNode
}
catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
solAssert(!m_errorReporter.errors().empty());
return false;
}
return true;
Expand Down Expand Up @@ -137,8 +136,7 @@ bool NameAndTypeResolver::resolveNamesAndTypes(SourceUnit& _source)
}
catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
solAssert(!m_errorReporter.errors().empty());
return false;
}
return true;
Expand All @@ -153,8 +151,7 @@ bool NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
}
catch (langutil::FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
solAssert(!m_errorReporter.errors().empty());
return false;
}
return true;
Expand Down
3 changes: 1 addition & 2 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ bool CompilerStack::analyze()
}
catch (FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
solAssert(!m_errorReporter.errors().empty());
noErrors = false;
}

Expand Down
3 changes: 1 addition & 2 deletions libsolidity/parsing/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ ASTPointer<SourceUnit> Parser::parse(CharStream& _charStream)
}
catch (FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
solAssert(!m_errorReporter.errors().empty());
return nullptr;
}
}
Expand Down
3 changes: 1 addition & 2 deletions libyul/ObjectParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ std::shared_ptr<Object> ObjectParser::parse(std::shared_ptr<Scanner> const& _sca
}
catch (FatalError const&)
{
if (m_errorReporter.errors().empty())
throw; // Something is weird here, rather throw again.
yulAssert(!m_errorReporter.errors().empty());
}
return nullptr;
}
Expand Down

0 comments on commit 1adb032

Please sign in to comment.