Removing scope rules for pre block in 'For Loops'

This commit is contained in:
fnatic
2019-04-17 05:58:40 +05:30
parent 94053c9a52
commit 5b6ed7a97c
24 changed files with 60 additions and 111 deletions
+3 -6
View File
@@ -112,10 +112,9 @@ void DataFlowAnalyzer::operator()(FunctionDefinition& _fun)
void DataFlowAnalyzer::operator()(ForLoop& _for)
{
// Special scope handling of the pre block.
pushScope(false);
for (auto& statement: _for.pre.statements)
visit(statement);
// If the pre block was not empty,
// we would have to deal with more complicated scoping rules.
assertThrow(_for.pre.statements.empty(), OptimizerException, "");
AssignmentsSinceContinue assignmentsSinceCont;
assignmentsSinceCont(_for.body);
@@ -130,8 +129,6 @@ void DataFlowAnalyzer::operator()(ForLoop& _for)
clearValues(assignmentsSinceCont.names());
(*this)(_for.post);
clearValues(assignments.names());
popScope();
}
void DataFlowAnalyzer::operator()(Block& _block)