File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,16 @@ bool ConstraintLocator::isForContextualType() const {
227
227
return isLastElement<LocatorPathElt::ContextualType>();
228
228
}
229
229
230
+ bool ConstraintLocator::isForAssignment () const {
231
+ auto *anchor = getAnchor ();
232
+ return anchor && isa<AssignExpr>(anchor) && getPath ().empty ();
233
+ }
234
+
235
+ bool ConstraintLocator::isForCoercion () const {
236
+ auto *anchor = getAnchor ();
237
+ return anchor && isa<CoerceExpr>(anchor) && getPath ().empty ();
238
+ }
239
+
230
240
GenericTypeParamType *ConstraintLocator::getGenericParameter () const {
231
241
// Check whether we have a path that terminates at a generic parameter.
232
242
return isForGenericParameter () ?
Original file line number Diff line number Diff line change @@ -360,6 +360,12 @@ class ConstraintLocator : public llvm::FoldingSetNode {
360
360
// / Determine whether this locator points to the contextual type.
361
361
bool isForContextualType () const ;
362
362
363
+ // / Determine whether this locator points to the assignment expression.
364
+ bool isForAssignment () const ;
365
+
366
+ // / Determine whether this locator points to the coercion expression.
367
+ bool isForCoercion () const ;
368
+
363
369
// / Attempts to cast the first path element of the locator to a specific
364
370
// / \c LocatorPathElt subclass, returning \c None if either unsuccessful or
365
371
// / the locator has no path elements.
You can’t perform that action at this time.
0 commit comments