@@ -1246,8 +1246,6 @@ void StmtEmitter::visitRepeatWhileStmt(RepeatWhileStmt *S) {
1246
1246
}
1247
1247
1248
1248
void StmtEmitter::visitForEachStmt (ForEachStmt *S) {
1249
- // Emit the 'iterator' variable that we'll be using for iteration.
1250
- LexicalScope OuterForScope (SGF, CleanupLocation (S));
1251
1249
1252
1250
if (auto *expansion =
1253
1251
dyn_cast<PackExpansionExpr>(S->getTypeCheckedSequence ())) {
@@ -1256,8 +1254,6 @@ void StmtEmitter::visitForEachStmt(ForEachStmt *S) {
1256
1254
->getCanonicalType ());
1257
1255
1258
1256
JumpDest loopDest = createJumpDest (S->getBody ());
1259
-
1260
- // Set the destinations for 'break' and 'continue'.
1261
1257
JumpDest endDest = createJumpDest (S->getBody ());
1262
1258
1263
1259
SGF.emitDynamicPackLoop (
@@ -1271,6 +1267,7 @@ void StmtEmitter::visitForEachStmt(ForEachStmt *S) {
1271
1267
1272
1268
SGF.emitExprInto (expansion->getPatternExpr (), letValueInit.get ());
1273
1269
1270
+ // Set the destinations for 'break' and 'continue'.
1274
1271
SGF.BreakContinueDestStack .push_back ({S, endDest, loopDest});
1275
1272
visit (S->getBody ());
1276
1273
SGF.BreakContinueDestStack .pop_back ();
@@ -1284,6 +1281,8 @@ void StmtEmitter::visitForEachStmt(ForEachStmt *S) {
1284
1281
return ;
1285
1282
}
1286
1283
1284
+ // Emit the 'iterator' variable that we'll be using for iteration.
1285
+ LexicalScope OuterForScope (SGF, CleanupLocation (S));
1287
1286
SGF.emitPatternBinding (S->getIteratorVar (),
1288
1287
/* index=*/ 0 , /* debuginfo*/ true );
1289
1288
0 commit comments