Keep canonical form of Yul code at all times.

This commit is contained in:
Daniel Kirchner
2021-11-09 13:29:10 +01:00
parent fc41083027
commit 9fb77b139c
9 changed files with 30 additions and 7 deletions
+12
View File
@@ -43,3 +43,15 @@ void BlockFlattener::operator()(Block& _block)
}
);
}
void BlockFlattener::run(OptimiserStepContext&, Block& _ast)
{
BlockFlattener flattener;
for (auto& statement: _ast.statements)
if (auto* block = get_if<Block>(&statement))
flattener(*block);
else if (auto* function = get_if<FunctionDefinition>(&statement))
flattener(function->body);
else
yulAssert(false, "BlockFlattener requires the FunctionGrouper.");
}