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 @@ -1603,6 +1603,12 @@ class SolutionApplicationTarget {
1603
1603
// / For a pattern initialization target, retrieve the contextual pattern.
1604
1604
ContextualPattern getContextualPattern () const ;
1605
1605
1606
+ // / Whether this target is for a for-in statement.
1607
+ bool isForEachStmt () const {
1608
+ return kind == Kind::expression &&
1609
+ getExprContextualTypePurpose () == CTP_ForEachStmt;
1610
+ }
1611
+
1606
1612
// / Whether this is an initialization for an Optional.Some pattern.
1607
1613
bool isOptionalSomePatternInit () const {
1608
1614
return kind == Kind::expression &&
@@ -1659,14 +1665,12 @@ class SolutionApplicationTarget {
1659
1665
}
1660
1666
1661
1667
const ForEachStmtInfo &getForEachStmtInfo () const {
1662
- assert (kind == Kind::expression);
1663
- assert (expression.contextualPurpose == CTP_ForEachStmt);
1668
+ assert (isForEachStmt ());
1664
1669
return expression.forEachStmt ;
1665
1670
}
1666
1671
1667
1672
ForEachStmtInfo &getForEachStmtInfo () {
1668
- assert (kind == Kind::expression);
1669
- assert (expression.contextualPurpose == CTP_ForEachStmt);
1673
+ assert (isForEachStmt ());
1670
1674
return expression.forEachStmt ;
1671
1675
}
1672
1676
You can’t perform that action at this time.
0 commit comments