mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CSDiag] NFC: Move findResolvedMemberRef to ConstraintSystem.cpp
This method is used by diagnostics and CSApply at this point.
This commit is contained in:
@@ -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();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user