@@ -197,6 +197,13 @@ void ConstraintGraphNode::notifyReferencingVars() const {
197
197
}
198
198
}
199
199
200
+ void ConstraintGraphNode::notifyReferencedVars (
201
+ llvm::function_ref<void (ConstraintGraphNode &)> notification) {
202
+ for (auto *fixedBinding : getReferencedVars ()) {
203
+ notification (CG[fixedBinding]);
204
+ }
205
+ }
206
+
200
207
void ConstraintGraphNode::addToEquivalenceClass (
201
208
ArrayRef<TypeVariableType *> typeVars) {
202
209
assert (forRepresentativeVar () &&
@@ -304,10 +311,10 @@ void ConstraintGraphNode::introduceToInference(Constraint *constraint,
304
311
if (!notifyReferencedVars || !isUsefulForReferencedVars (constraint))
305
312
return ;
306
313
307
- for ( auto *fixedBinding : getReferencedVars () ) {
308
- CG[fixedBinding] .introduceToInference (constraint,
309
- /* notifyReferencedVars=*/ false );
310
- }
314
+ this -> notifyReferencedVars ([&](ConstraintGraphNode &referencedVar ) {
315
+ referencedVar .introduceToInference (constraint,
316
+ /* notifyReferencedVars=*/ false );
317
+ });
311
318
}
312
319
313
320
void ConstraintGraphNode::retractFromInference (Constraint *constraint,
@@ -325,10 +332,10 @@ void ConstraintGraphNode::retractFromInference(Constraint *constraint,
325
332
if (!notifyReferencedVars || !isUsefulForReferencedVars (constraint))
326
333
return ;
327
334
328
- for ( auto *fixedBinding : getReferencedVars () ) {
329
- CG[fixedBinding] .retractFromInference (constraint,
330
- /* notifyReferencedVars=*/ false );
331
- }
335
+ this -> notifyReferencedVars ([&](ConstraintGraphNode &referencedVar ) {
336
+ referencedVar .retractFromInference (constraint,
337
+ /* notifyReferencedVars=*/ false );
338
+ });
332
339
}
333
340
334
341
void ConstraintGraphNode::reintroduceToInference (Constraint *constraint,
0 commit comments