[CSDiag] NFC: Move findResolvedMemberRef to ConstraintSystem.cpp

This method is used by diagnostics and CSApply at this point.
This commit is contained in:
Pavel Yaskevich
2020-01-14 12:51:48 -08:00
parent faf3be4e8a
commit 0aadb7c6a5
2 changed files with 16 additions and 16 deletions

View File

@@ -3940,3 +3940,19 @@ Expr *ConstraintSystem::buildAutoClosureExpr(Expr *expr,
cacheExprTypes(result);
return result;
}
/// If an UnresolvedDotExpr, SubscriptMember, etc has been resolved by the
/// constraint system, return the decl that it references.
ValueDecl *ConstraintSystem::findResolvedMemberRef(ConstraintLocator *locator) {
// See if we have a resolution for this member.
auto overload = findSelectedOverloadFor(locator);
if (!overload)
return nullptr;
// We only want to handle the simplest decl binding.
auto choice = overload->choice;
if (choice.getKind() != OverloadChoiceKind::Decl)
return nullptr;
return choice.getDecl();
}