[CS] Allow getCalleeLocator to find key path component callees

In order to do this we need it to take a ConstraintLocator argument so
we can tell which component we want the callee for. To make it clear
that we're looking for a callee at the anchor, also rename the member
to getAnchormostCalleeLocator.
This commit is contained in:
Hamish Knight
2019-08-30 16:19:57 +01:00
parent b8b93eb7f5
commit 67ee821123
5 changed files with 86 additions and 32 deletions

View File

@@ -4243,11 +4243,11 @@ namespace {
auto locator = cs.getConstraintLocator(
E, LocatorPathElt::KeyPathComponent(i));
if (kind == KeyPathExpr::Component::Kind::UnresolvedSubscript) {
locator =
cs.getConstraintLocator(locator,
ConstraintLocator::SubscriptMember);
}
// Adjust the locator such that it includes any additional elements to
// point to the component's callee, e.g a SubscriptMember for a
// subscript component.
locator = cs.getAnchormostCalleeLocator(locator);
bool isDynamicMember = false;
// If this is an unresolved link, make sure we resolved it.