Merge pull request #11980 from ethereum/useIterateReplacingInStatementRemover

Use iterateReplacing in StatementRemover.
This commit is contained in:
Harikrishnan Mulackal
2021-09-16 16:15:07 +02:00
committed by GitHub
+10 -3
View File
@@ -159,8 +159,15 @@ void RedundantStoreBase::merge(TrackedStores& _target, vector<TrackedStores>&& _
void StatementRemover::operator()(Block& _block)
{
ranges::actions::remove_if(_block.statements, [&](Statement const& _statement) -> bool {
return m_toRemove.count(&_statement);
});
util::iterateReplacing(
_block.statements,
[&](Statement& _statement) -> std::optional<vector<Statement>>
{
if (m_toRemove.count(&_statement))
return {vector<Statement>{}};
else
return nullopt;
}
);
ASTModifier::operator()(_block);
}