@@ -161,10 +161,9 @@ class SyntacticElementTarget {
161161 ForEachStmt *stmt;
162162 DeclContext *dc;
163163 Pattern *pattern;
164- bool ignoreWhereClause;
165164 GenericEnvironment *packElementEnv;
166165 ForEachStmtInfo info;
167- } forEachStmt ;
166+ } forEachPreamble ;
168167
169168 PatternBindingDecl *patternBinding;
170169 };
@@ -242,13 +241,11 @@ class SyntacticElementTarget {
242241 }
243242
244243 SyntacticElementTarget (ForEachStmt *stmt, DeclContext *dc,
245- bool ignoreWhereClause,
246244 GenericEnvironment *packElementEnv)
247245 : kind(Kind::forEachPreamble) {
248- forEachStmt.stmt = stmt;
249- forEachStmt.dc = dc;
250- forEachStmt.ignoreWhereClause = ignoreWhereClause;
251- forEachStmt.packElementEnv = packElementEnv;
246+ forEachPreamble.stmt = stmt;
247+ forEachPreamble.dc = dc;
248+ forEachPreamble.packElementEnv = packElementEnv;
252249 }
253250
254251 // / Form a target for the initialization of a pattern from an expression.
@@ -267,10 +264,10 @@ class SyntacticElementTarget {
267264 static SyntacticElementTarget
268265 forReturn (ReturnStmt *returnStmt, Type contextTy, DeclContext *dc);
269266
270- // / Form a target for the preamble of a for-in loop, excluding its body.
267+ // / Form a target for the preamble of a for-in loop, excluding its where
268+ // / clause and body.
271269 static SyntacticElementTarget
272270 forForEachPreamble (ForEachStmt *stmt, DeclContext *dc,
273- bool ignoreWhereClause = false ,
274271 GenericEnvironment *packElementEnv = nullptr );
275272
276273 // / Form a target for a property with an attached property wrapper that is
@@ -372,7 +369,7 @@ class SyntacticElementTarget {
372369 }
373370
374371 case Kind::forEachPreamble:
375- return forEachStmt .dc ;
372+ return forEachPreamble .dc ;
376373 }
377374 llvm_unreachable (" invalid decl context type" );
378375 }
@@ -541,24 +538,19 @@ class SyntacticElementTarget {
541538 return expression.initialization .patternBindingIndex ;
542539 }
543540
544- bool ignoreForEachWhereClause () const {
545- assert (isForEachPreamble ());
546- return forEachStmt.ignoreWhereClause ;
547- }
548-
549541 GenericEnvironment *getPackElementEnv () const {
550542 assert (isForEachPreamble ());
551- return forEachStmt .packElementEnv ;
543+ return forEachPreamble .packElementEnv ;
552544 }
553545
554546 const ForEachStmtInfo &getForEachStmtInfo () const {
555547 assert (isForEachPreamble ());
556- return forEachStmt .info ;
548+ return forEachPreamble .info ;
557549 }
558550
559551 ForEachStmtInfo &getForEachStmtInfo () {
560552 assert (isForEachPreamble ());
561- return forEachStmt .info ;
553+ return forEachPreamble .info ;
562554 }
563555
564556 // / Whether this context infers an opaque return type.
@@ -585,7 +577,7 @@ class SyntacticElementTarget {
585577 return getInitializationPattern ();
586578
587579 if (kind == Kind::forEachPreamble)
588- return forEachStmt .pattern ;
580+ return forEachPreamble .pattern ;
589581
590582 return nullptr ;
591583 }
@@ -598,7 +590,7 @@ class SyntacticElementTarget {
598590 }
599591
600592 if (kind == Kind::forEachPreamble) {
601- forEachStmt .pattern = pattern;
593+ forEachPreamble .pattern = pattern;
602594 return ;
603595 }
604596
@@ -729,7 +721,7 @@ class SyntacticElementTarget {
729721 return nullptr ;
730722
731723 case Kind::forEachPreamble:
732- return forEachStmt .stmt ;
724+ return forEachPreamble .stmt ;
733725 }
734726 llvm_unreachable (" invalid case label type" );
735727 }
@@ -841,7 +833,7 @@ class SyntacticElementTarget {
841833
842834 // For-in preamble target doesn't cover the body.
843835 case Kind::forEachPreamble:
844- auto *stmt = forEachStmt .stmt ;
836+ auto *stmt = forEachPreamble .stmt ;
845837 SourceLoc startLoc = stmt->getForLoc ();
846838 SourceLoc endLoc = stmt->getParsedSequence ()->getEndLoc ();
847839
@@ -884,7 +876,7 @@ class SyntacticElementTarget {
884876 }
885877
886878 case Kind::forEachPreamble:
887- return forEachStmt .stmt ->getStartLoc ();
879+ return forEachPreamble .stmt ->getStartLoc ();
888880 }
889881 llvm_unreachable (" invalid target type" );
890882 }
0 commit comments