Skip to content

Commit

Permalink
Use solAssert() instead of throwing InternalCompilerError directly
Browse files Browse the repository at this point in the history
  • Loading branch information
cameel committed Jun 12, 2024
1 parent 1adb032 commit 9068112
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 19 deletions.
4 changes: 1 addition & 3 deletions libsolidity/codegen/ExpressionCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2952,9 +2952,7 @@ void ExpressionCompiler::setLValueFromDeclaration(Declaration const& _declaratio
else if (m_context.isStateVariable(&_declaration))
setLValue<StorageItem>(_expression, dynamic_cast<VariableDeclaration const&>(_declaration));
else
BOOST_THROW_EXCEPTION(InternalCompilerError()
<< errinfo_sourceLocation(_expression.location())
<< util::errinfo_comment("Identifier type not supported or identifier not found."));
solAssert(false, "Identifier type not supported or identifier not found.");
}

void ExpressionCompiler::setLValueToStorageItem(Expression const& _expression)
Expand Down
5 changes: 1 addition & 4 deletions libsolidity/codegen/LValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
m_context << Instruction::SWAP1 << Instruction::POP;
}
else
BOOST_THROW_EXCEPTION(
InternalCompilerError()
<< errinfo_sourceLocation(_location)
<< util::errinfo_comment("Invalid non-value type for assignment."));
solAssert(false, "Invalid non-value type for assignment.");
}
}

Expand Down
1 change: 0 additions & 1 deletion libsolidity/interface/FileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <functional>

using solidity::frontend::ReadCallback;
using solidity::langutil::InternalCompilerError;
using solidity::util::errinfo_comment;
using solidity::util::readFileAsString;
using solidity::util::joinHumanReadable;
Expand Down
4 changes: 0 additions & 4 deletions libsolidity/interface/SMTSolverCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#include <boost/filesystem/fstream.hpp>
#include <boost/process.hpp>

using solidity::langutil::InternalCompilerError;
using solidity::util::errinfo_comment;


namespace solidity::frontend
{

Expand Down
9 changes: 2 additions & 7 deletions libsolidity/interface/StandardCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,13 +1463,8 @@ Json StandardCompiler::compileSolidity(StandardCompiler::InputsAndSettings _inpu
// Note that not completing analysis due to stopAfter does not count as a failure. It's neither failure nor success.
bool analysisFailed = !analysisSuccess && _inputsAndSettings.stopAfter >= CompilerStack::State::AnalysisSuccessful;
bool compilationFailed = !compilationSuccess && binariesRequested;

/// Inconsistent state - stop here to receive error reports from users
if (
(compilationFailed || analysisFailed || !parsingSuccess) &&
errors.empty()
)
return formatFatalError(Error::Type::InternalCompilerError, "No error reported, but compilation failed.");
if (compilationFailed || analysisFailed || !parsingSuccess)
solAssert(!errors.empty(), "No error reported, but compilation failed.");

Json output;

Expand Down

0 comments on commit 9068112

Please sign in to comment.