Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index 502e88cd1f229bfba518a48a1f49d76808026c35..ade11d4865dc4f1c6123113b926c21ecb851241c 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -1037,9 +1037,13 @@ class SsaBuilder extends ast.Visitor |
closureToClassMapper.getMemberMap(callee); |
localsHandler.closureData = newClosureData; |
if (resolvedAst.kind == ResolvedAstKind.PARSED) { |
- localsHandler.enterScope( |
- newClosureData.capturingScopes[resolvedAst.node], |
- forGenerativeConstructorBody: callee.isGenerativeConstructorBody); |
+ // TODO(efortuna): Take out the test below for null once we are no |
+ // longer dealing with the ClosureClassMap interface directly. |
+ if (newClosureData.capturingScopes[resolvedAst.node] != null) { |
+ localsHandler.enterScope( |
+ newClosureData.capturingScopes[resolvedAst.node], |
+ forGenerativeConstructorBody: callee.isGenerativeConstructorBody); |
+ } |
} |
buildInitializers(callee, constructorResolvedAsts, fieldValues); |
localsHandler.closureData = oldClosureData; |
@@ -1727,7 +1731,12 @@ class SsaBuilder extends ast.Visitor |
} |
loopHandler.handleLoop( |
- node, buildInitializer, buildCondition, buildUpdate, buildBody); |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ buildInitializer, |
+ buildCondition, |
+ buildUpdate, |
+ buildBody); |
} |
visitWhile(ast.While node) { |
@@ -1737,7 +1746,12 @@ class SsaBuilder extends ast.Visitor |
return popBoolified(); |
} |
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, () { |
+ loopHandler.handleLoop( |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ () {}, |
+ buildCondition, |
+ () {}, () { |
visit(node.body); |
}); |
} |
@@ -1745,7 +1759,9 @@ class SsaBuilder extends ast.Visitor |
visitDoWhile(ast.DoWhile node) { |
assert(isReachable); |
LocalsHandler savedLocals = new LocalsHandler.from(localsHandler); |
- localsHandler.startLoop(node); |
+ var loopClosureInfo = |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node); |
+ localsHandler.startLoop(loopClosureInfo); |
loopDepth++; |
JumpHandler jumpHandler = loopHandler.beginLoopHeader(node); |
HLoopInformation loopInfo = current.loopInformation; |
@@ -1763,7 +1779,7 @@ class SsaBuilder extends ast.Visitor |
// Using a separate block is just a simple workaround. |
bodyEntryBlock = openNewBlock(); |
} |
- localsHandler.enterLoopBody(node); |
+ localsHandler.enterLoopBody(loopClosureInfo); |
visit(node.body); |
// If there are no continues we could avoid the creation of the condition |
@@ -5452,7 +5468,12 @@ class SsaBuilder extends ast.Visitor |
buildProtectedByFinally(() { |
loopHandler.handleLoop( |
- node, buildInitializer, buildCondition, buildUpdate, buildBody); |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ buildInitializer, |
+ buildCondition, |
+ buildUpdate, |
+ buildBody); |
}, () { |
pushInvokeDynamic(node, Selectors.cancel, null, [streamIterator]); |
push(new HAwait(pop(), |
@@ -5519,7 +5540,12 @@ class SsaBuilder extends ast.Visitor |
} |
loopHandler.handleLoop( |
- node, buildInitializer, buildCondition, () {}, buildBody); |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ buildInitializer, |
+ buildCondition, |
+ () {}, |
+ buildBody); |
} |
buildAssignLoopVariable(ast.ForIn node, HInstruction value) { |
@@ -5638,7 +5664,12 @@ class SsaBuilder extends ast.Visitor |
} |
loopHandler.handleLoop( |
- node, buildInitializer, buildCondition, buildUpdate, buildBody); |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ buildInitializer, |
+ buildCondition, |
+ buildUpdate, |
+ buildBody); |
} |
visitLabel(ast.Label node) { |
@@ -5985,7 +6016,13 @@ class SsaBuilder extends ast.Visitor |
} |
void buildLoop() { |
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, buildSwitch); |
+ loopHandler.handleLoop( |
+ node, |
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node), |
+ () {}, |
+ buildCondition, |
+ () {}, |
+ buildSwitch); |
} |
if (hasDefault) { |