[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

@@ -2303,19 +2303,3 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
diagnose(E->getLoc(), diag::type_of_expression_is_ambiguous) diagnose(E->getLoc(), diag::type_of_expression_is_ambiguous)
.highlight(E->getSourceRange()); .highlight(E->getSourceRange());
} }
/// 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();
}

View File

@@ -3940,3 +3940,19 @@ Expr *ConstraintSystem::buildAutoClosureExpr(Expr *expr,
cacheExprTypes(result); cacheExprTypes(result);
return 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();
}