aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/CommonSubexpressionEliminator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libyul/optimiser/CommonSubexpressionEliminator.cpp')
-rw-r--r--libyul/optimiser/CommonSubexpressionEliminator.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libyul/optimiser/CommonSubexpressionEliminator.cpp b/libyul/optimiser/CommonSubexpressionEliminator.cpp
index 23d15cad..51737097 100644
--- a/libyul/optimiser/CommonSubexpressionEliminator.cpp
+++ b/libyul/optimiser/CommonSubexpressionEliminator.cpp
@@ -50,8 +50,8 @@ void CommonSubexpressionEliminator::visit(Expression& _e)
if (m_value.at(name)->type() == typeid(Identifier))
{
string const& value = boost::get<Identifier>(*m_value.at(name)).name;
- if (inScope(value))
- _e = Identifier{locationOf(_e), value};
+ assertThrow(inScope(value), OptimizerException, "");
+ _e = Identifier{locationOf(_e), value};
}
}
}
@@ -61,6 +61,7 @@ void CommonSubexpressionEliminator::visit(Expression& _e)
for (auto const& var: m_value)
{
assertThrow(var.second, OptimizerException, "");
+ assertThrow(inScope(var.first), OptimizerException, "");
if (SyntacticalEqualityChecker::equal(_e, *var.second))
{
_e = Identifier{locationOf(_e), var.first};