mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IDE: Simplify/Refactor some code that collects the default implementations in protocol extensions. NFC (#8381)
This commit is contained in:
@@ -54,14 +54,14 @@ using namespace swift;
|
||||
|
||||
struct SynthesizedExtensionAnalyzer::Implementation {
|
||||
static bool isMemberFavored(const NominalTypeDecl* Target, const Decl* D) {
|
||||
DeclContext* DC = Target->getDeclContext();
|
||||
DeclContext* DC = Target->getInnermostDeclContext();
|
||||
Type BaseTy = Target->getDeclaredTypeInContext();
|
||||
const FuncDecl *FD = dyn_cast<FuncDecl>(D);
|
||||
if (!FD)
|
||||
return true;
|
||||
ResolveMemberResult Result = resolveValueMember(*DC, BaseTy,
|
||||
FD->getEffectiveFullName());
|
||||
return !(Result && Result.Favored != D);
|
||||
return !(Result.hasBestOverload() && Result.getBestOverload() != D);
|
||||
}
|
||||
|
||||
static bool isExtensionFavored(const NominalTypeDecl* Target,
|
||||
@@ -1647,8 +1647,9 @@ static bool shouldPrintAsFavorable(const Decl *D, PrintOptions &Options) {
|
||||
if (!FD)
|
||||
return true;
|
||||
ResolveMemberResult Result = resolveValueMember(*Target->getDeclContext(),
|
||||
BaseTy, FD->getEffectiveFullName());
|
||||
return !(Result && Result.Favored != D);
|
||||
BaseTy,
|
||||
FD->getEffectiveFullName());
|
||||
return !(Result.hasBestOverload() && Result.getBestOverload() != D);
|
||||
}
|
||||
|
||||
bool swift::shouldPrint(const Decl *D, PrintOptions &Options) {
|
||||
|
||||
Reference in New Issue
Block a user