Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/SILGen/SILGenStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,8 @@ void StmtEmitter::visitForEachStmt(ForEachStmt *S) {
PackType::get(SGF.getASTContext(), expansion->getType())
->getCanonicalType());

JumpDest loopDest = createJumpDest(S->getBody());
JumpDest endDest = createJumpDest(S->getBody());
JumpDest continueDest = createJumpDest(S->getBody());
JumpDest breakDest = createJumpDest(S->getBody());

SGF.emitDynamicPackLoop(
SILLocation(expansion), formalPackType, 0,
Expand All @@ -1263,20 +1263,20 @@ void StmtEmitter::visitForEachStmt(ForEachStmt *S) {
SILValue packIndex) {
Scope innerForScope(SGF.Cleanups, CleanupLocation(S->getBody()));
auto letValueInit =
SGF.emitPatternBindingInitialization(S->getPattern(), loopDest);
SGF.emitPatternBindingInitialization(S->getPattern(), continueDest);

SGF.emitExprInto(expansion->getPatternExpr(), letValueInit.get());

// Set the destinations for 'break' and 'continue'.
SGF.BreakContinueDestStack.push_back({S, endDest, loopDest});
SGF.BreakContinueDestStack.push_back({S, breakDest, continueDest});
visit(S->getBody());
SGF.BreakContinueDestStack.pop_back();

return;
},
loopDest.getBlock());
continueDest.getBlock());

emitOrDeleteBlock(SGF, endDest, S);
emitOrDeleteBlock(SGF, breakDest, S);

return;
}
Expand Down