Skip to content

Commit af7b722

Browse files
committed
[ConstraintLocator] Introduce endsWith convenience function
1 parent 30d09de commit af7b722

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/swift/Sema/ConstraintLocator.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,16 @@ class ConstraintLocatorBuilder {
12951295
return None;
12961296
}
12971297

1298+
/// Check whether this locator has the given locator path element
1299+
/// at the end of its path.
1300+
template <class Kind>
1301+
bool endsWith() const {
1302+
if (auto lastElt = last()) {
1303+
return lastElt->is<Kind>();
1304+
}
1305+
return false;
1306+
}
1307+
12981308
/// Produce a debugging dump of this locator.
12991309
SWIFT_DEBUG_DUMPER(dump(SourceManager *SM));
13001310
SWIFT_DEBUG_DUMPER(dump(ConstraintSystem *CS));

0 commit comments

Comments
 (0)