@@ -803,6 +803,10 @@ struct ContextualTypeInfo {
803
803
Type getType () const { return typeLoc.getType (); }
804
804
};
805
805
806
+
807
+ // / Key to the constraint solver's mapping from AST nodes to their corresponding
808
+ // / solution application targets.
809
+ using SolutionApplicationTargetsKey = const StmtConditionElement *;
806
810
// / A complete solution to a constraint system.
807
811
// /
808
812
// / A solution to a constraint system consists of type variable bindings to
@@ -868,9 +872,9 @@ class Solution {
868
872
// / Contextual types introduced by this solution.
869
873
std::vector<std::pair<const Expr *, ContextualTypeInfo>> contextualTypes;
870
874
871
- // / Maps statement condition entries to their solution application targets.
872
- llvm::MapVector<const StmtConditionElement * , SolutionApplicationTarget>
873
- stmtConditionTargets ;
875
+ // / Maps AST nodes to their solution application targets.
876
+ llvm::MapVector<SolutionApplicationTargetsKey , SolutionApplicationTarget>
877
+ solutionApplicationTargets ;
874
878
875
879
std::vector<std::pair<ConstraintLocator *, ProtocolConformanceRef>>
876
880
Conformances;
@@ -1546,9 +1550,9 @@ class ConstraintSystem {
1546
1550
llvm::DenseMap<std::pair<const KeyPathExpr *, unsigned >, TypeBase *>
1547
1551
KeyPathComponentTypes;
1548
1552
1549
- // / Maps statement condition entries to their solution application targets.
1550
- llvm::MapVector<const StmtConditionElement * , SolutionApplicationTarget>
1551
- stmtConditionTargets ;
1553
+ // / Maps AST entries to their solution application targets.
1554
+ llvm::MapVector<SolutionApplicationTargetsKey , SolutionApplicationTarget>
1555
+ solutionApplicationTargets ;
1552
1556
1553
1557
// / Contextual type information for expressions that are part of this
1554
1558
// / constraint system.
@@ -2131,8 +2135,8 @@ class ConstraintSystem {
2131
2135
// / The length of \c contextualTypes.
2132
2136
unsigned numContextualTypes;
2133
2137
2134
- // / The length of \c stmtConditionTargets .
2135
- unsigned numStmtConditionTargets ;
2138
+ // / The length of \c solutionApplicationTargets .
2139
+ unsigned numSolutionApplicationTargets ;
2136
2140
2137
2141
// / The previous score.
2138
2142
Score PreviousScore;
@@ -2421,18 +2425,18 @@ class ConstraintSystem {
2421
2425
return CTP_Unused;
2422
2426
}
2423
2427
2424
- void setStmtConditionTarget (
2425
- const StmtConditionElement *element , SolutionApplicationTarget target) {
2426
- assert (element != nullptr && " Expected non-null condition element !" );
2427
- assert (stmtConditionTargets .count (element ) == 0 &&
2428
- " Already set this condition target" );
2429
- stmtConditionTargets .insert ({element , target});
2428
+ void setSolutionApplicationTarget (
2429
+ SolutionApplicationTargetsKey key , SolutionApplicationTarget target) {
2430
+ assert (key && " Expected non-null solution application target key !" );
2431
+ assert (solutionApplicationTargets .count (key ) == 0 &&
2432
+ " Already set this solution application target" );
2433
+ solutionApplicationTargets .insert ({key , target});
2430
2434
}
2431
2435
2432
- Optional<SolutionApplicationTarget> getStmtConditionTarget (
2433
- const StmtConditionElement *element ) const {
2434
- auto known = stmtConditionTargets .find (element );
2435
- if (known == stmtConditionTargets .end ())
2436
+ Optional<SolutionApplicationTarget> getSolutionApplicationTarget (
2437
+ SolutionApplicationTargetsKey key ) const {
2438
+ auto known = solutionApplicationTargets .find (key );
2439
+ if (known == solutionApplicationTargets .end ())
2436
2440
return None;
2437
2441
return known->second ;
2438
2442
}
0 commit comments