@@ -161,10 +161,9 @@ class SyntacticElementTarget {
161
161
ForEachStmt *stmt;
162
162
DeclContext *dc;
163
163
Pattern *pattern;
164
- bool ignoreWhereClause;
165
164
GenericEnvironment *packElementEnv;
166
165
ForEachStmtInfo info;
167
- } forEachStmt ;
166
+ } forEachPreamble ;
168
167
169
168
PatternBindingDecl *patternBinding;
170
169
};
@@ -242,13 +241,11 @@ class SyntacticElementTarget {
242
241
}
243
242
244
243
SyntacticElementTarget (ForEachStmt *stmt, DeclContext *dc,
245
- bool ignoreWhereClause,
246
244
GenericEnvironment *packElementEnv)
247
245
: 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;
252
249
}
253
250
254
251
// / Form a target for the initialization of a pattern from an expression.
@@ -267,10 +264,10 @@ class SyntacticElementTarget {
267
264
static SyntacticElementTarget
268
265
forReturn (ReturnStmt *returnStmt, Type contextTy, DeclContext *dc);
269
266
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.
271
269
static SyntacticElementTarget
272
270
forForEachPreamble (ForEachStmt *stmt, DeclContext *dc,
273
- bool ignoreWhereClause = false ,
274
271
GenericEnvironment *packElementEnv = nullptr );
275
272
276
273
// / Form a target for a property with an attached property wrapper that is
@@ -372,7 +369,7 @@ class SyntacticElementTarget {
372
369
}
373
370
374
371
case Kind::forEachPreamble:
375
- return forEachStmt .dc ;
372
+ return forEachPreamble .dc ;
376
373
}
377
374
llvm_unreachable (" invalid decl context type" );
378
375
}
@@ -541,24 +538,19 @@ class SyntacticElementTarget {
541
538
return expression.initialization .patternBindingIndex ;
542
539
}
543
540
544
- bool ignoreForEachWhereClause () const {
545
- assert (isForEachPreamble ());
546
- return forEachStmt.ignoreWhereClause ;
547
- }
548
-
549
541
GenericEnvironment *getPackElementEnv () const {
550
542
assert (isForEachPreamble ());
551
- return forEachStmt .packElementEnv ;
543
+ return forEachPreamble .packElementEnv ;
552
544
}
553
545
554
546
const ForEachStmtInfo &getForEachStmtInfo () const {
555
547
assert (isForEachPreamble ());
556
- return forEachStmt .info ;
548
+ return forEachPreamble .info ;
557
549
}
558
550
559
551
ForEachStmtInfo &getForEachStmtInfo () {
560
552
assert (isForEachPreamble ());
561
- return forEachStmt .info ;
553
+ return forEachPreamble .info ;
562
554
}
563
555
564
556
// / Whether this context infers an opaque return type.
@@ -585,7 +577,7 @@ class SyntacticElementTarget {
585
577
return getInitializationPattern ();
586
578
587
579
if (kind == Kind::forEachPreamble)
588
- return forEachStmt .pattern ;
580
+ return forEachPreamble .pattern ;
589
581
590
582
return nullptr ;
591
583
}
@@ -598,7 +590,7 @@ class SyntacticElementTarget {
598
590
}
599
591
600
592
if (kind == Kind::forEachPreamble) {
601
- forEachStmt .pattern = pattern;
593
+ forEachPreamble .pattern = pattern;
602
594
return ;
603
595
}
604
596
@@ -729,7 +721,7 @@ class SyntacticElementTarget {
729
721
return nullptr ;
730
722
731
723
case Kind::forEachPreamble:
732
- return forEachStmt .stmt ;
724
+ return forEachPreamble .stmt ;
733
725
}
734
726
llvm_unreachable (" invalid case label type" );
735
727
}
@@ -841,7 +833,7 @@ class SyntacticElementTarget {
841
833
842
834
// For-in preamble target doesn't cover the body.
843
835
case Kind::forEachPreamble:
844
- auto *stmt = forEachStmt .stmt ;
836
+ auto *stmt = forEachPreamble .stmt ;
845
837
SourceLoc startLoc = stmt->getForLoc ();
846
838
SourceLoc endLoc = stmt->getParsedSequence ()->getEndLoc ();
847
839
@@ -884,7 +876,7 @@ class SyntacticElementTarget {
884
876
}
885
877
886
878
case Kind::forEachPreamble:
887
- return forEachStmt .stmt ->getStartLoc ();
879
+ return forEachPreamble .stmt ->getStartLoc ();
888
880
}
889
881
llvm_unreachable (" invalid target type" );
890
882
}
0 commit comments