@@ -868,6 +868,10 @@ class Solution {
868
868
// / Contextual types introduced by this solution.
869
869
std::vector<std::pair<const Expr *, ContextualTypeInfo>> contextualTypes;
870
870
871
+ // / Maps statement condition entries to their solution application targets.
872
+ llvm::MapVector<const StmtConditionElement *, SolutionApplicationTarget>
873
+ stmtConditionTargets;
874
+
871
875
std::vector<std::pair<ConstraintLocator *, ProtocolConformanceRef>>
872
876
Conformances;
873
877
@@ -1487,6 +1491,10 @@ class ConstraintSystem {
1487
1491
llvm::DenseMap<std::pair<const KeyPathExpr *, unsigned >, TypeBase *>
1488
1492
KeyPathComponentTypes;
1489
1493
1494
+ // / Maps statement condition entries to their solution application targets.
1495
+ llvm::MapVector<const StmtConditionElement *, SolutionApplicationTarget>
1496
+ stmtConditionTargets;
1497
+
1490
1498
// / Contextual type information for expressions that are part of this
1491
1499
// / constraint system.
1492
1500
llvm::MapVector<const Expr *, ContextualTypeInfo> contextualTypes;
@@ -2068,6 +2076,9 @@ class ConstraintSystem {
2068
2076
// / The length of \c contextualTypes.
2069
2077
unsigned numContextualTypes;
2070
2078
2079
+ // / The length of \c stmtConditionTargets.
2080
+ unsigned numStmtConditionTargets;
2081
+
2071
2082
// / The previous score.
2072
2083
Score PreviousScore;
2073
2084
@@ -2355,6 +2366,22 @@ class ConstraintSystem {
2355
2366
return CTP_Unused;
2356
2367
}
2357
2368
2369
+ void setStmtConditionTarget (
2370
+ const StmtConditionElement *element, SolutionApplicationTarget target) {
2371
+ assert (element != nullptr && " Expected non-null condition element!" );
2372
+ assert (stmtConditionTargets.count (element) == 0 &&
2373
+ " Already set this condition target" );
2374
+ stmtConditionTargets.insert ({element, target});
2375
+ }
2376
+
2377
+ Optional<SolutionApplicationTarget> getStmtConditionTarget (
2378
+ const StmtConditionElement *element) const {
2379
+ auto known = stmtConditionTargets.find (element);
2380
+ if (known == stmtConditionTargets.end ())
2381
+ return None;
2382
+ return known->second ;
2383
+ }
2384
+
2358
2385
// / Retrieve the constraint locator for the given anchor and
2359
2386
// / path, uniqued.
2360
2387
ConstraintLocator *
0 commit comments