mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Keep canonical form of Yul code at all times.
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user