aboutsummaryrefslogtreecommitdiffstats
path: root/libyul/optimiser/ForLoopInitRewriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libyul/optimiser/ForLoopInitRewriter.cpp')
-rw-r--r--libyul/optimiser/ForLoopInitRewriter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/libyul/optimiser/ForLoopInitRewriter.cpp b/libyul/optimiser/ForLoopInitRewriter.cpp
index 80d39248..36d5db68 100644
--- a/libyul/optimiser/ForLoopInitRewriter.cpp
+++ b/libyul/optimiser/ForLoopInitRewriter.cpp
@@ -27,17 +27,24 @@ void ForLoopInitRewriter::operator()(Block& _block)
{
iterateReplacing(
_block.statements,
- [](Statement& _stmt) -> boost::optional<vector<Statement>>
+ [&](Statement& _stmt) -> boost::optional<vector<Statement>>
{
if (_stmt.type() == typeid(ForLoop))
{
auto& forLoop = boost::get<ForLoop>(_stmt);
+ (*this)(forLoop.pre);
+ (*this)(forLoop.body);
+ (*this)(forLoop.post);
vector<Statement> rewrite;
swap(rewrite, forLoop.pre.statements);
rewrite.emplace_back(move(forLoop));
return rewrite;
}
- return {};
+ else
+ {
+ visit(_stmt);
+ return {};
+ }
}
);
}