File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1418,6 +1418,12 @@ class SolutionApplicationTarget {
1418
1418
// / For a pattern initialization target, retrieve the contextual pattern.
1419
1419
ContextualPattern getContextualPattern () const ;
1420
1420
1421
+ // / Whether this target is for a for-in statement.
1422
+ bool isForEachStmt () const {
1423
+ return kind == Kind::expression &&
1424
+ getExprContextualTypePurpose () == CTP_ForEachStmt;
1425
+ }
1426
+
1421
1427
// / Whether this is an initialization for an Optional.Some pattern.
1422
1428
bool isOptionalSomePatternInit () const {
1423
1429
return kind == Kind::expression &&
@@ -1466,14 +1472,12 @@ class SolutionApplicationTarget {
1466
1472
}
1467
1473
1468
1474
const ForEachStmtInfo &getForEachStmtInfo () const {
1469
- assert (kind == Kind::expression);
1470
- assert (expression.contextualPurpose == CTP_ForEachStmt);
1475
+ assert (isForEachStmt ());
1471
1476
return expression.forEachStmt ;
1472
1477
}
1473
1478
1474
1479
ForEachStmtInfo &getForEachStmtInfo () {
1475
- assert (kind == Kind::expression);
1476
- assert (expression.contextualPurpose == CTP_ForEachStmt);
1480
+ assert (isForEachStmt ());
1477
1481
return expression.forEachStmt ;
1478
1482
}
1479
1483
You can’t perform that action at this time.
0 commit comments