mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Name lookup] Remove NL_VisitSupertypes.
Name lookup into a class type always looks into its supertypes; if you want to look directly into a particular class and its extensions, use lookupDirect and filter.
This commit is contained in:
@@ -1451,16 +1451,14 @@ bool DeclContext::lookupQualified(Type type,
|
||||
if (visited.insert(proto).second)
|
||||
stack.push_back(proto);
|
||||
|
||||
// If requested, look into the superclasses of this archetype.
|
||||
if (options & NL_VisitSupertypes) {
|
||||
if (auto superclassTy = archetypeTy->getSuperclass()) {
|
||||
if (auto superclassDecl = superclassTy->getAnyNominal()) {
|
||||
if (visited.insert(superclassDecl).second) {
|
||||
stack.push_back(superclassDecl);
|
||||
// Look into the superclasses of this archetype.
|
||||
if (auto superclassTy = archetypeTy->getSuperclass()) {
|
||||
if (auto superclassDecl = superclassTy->getAnyNominal()) {
|
||||
if (visited.insert(superclassDecl).second) {
|
||||
stack.push_back(superclassDecl);
|
||||
|
||||
wantProtocolMembers = (options & NL_ProtocolMembers) &&
|
||||
!isa<ProtocolDecl>(superclassDecl);
|
||||
}
|
||||
wantProtocolMembers = (options & NL_ProtocolMembers) &&
|
||||
!isa<ProtocolDecl>(superclassDecl);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1564,10 +1562,6 @@ bool DeclContext::lookupQualified(Type type,
|
||||
decls.push_back(decl);
|
||||
}
|
||||
|
||||
// If we're not supposed to visit our supertypes, we're done.
|
||||
if ((options & NL_VisitSupertypes) == 0)
|
||||
continue;
|
||||
|
||||
// Visit superclass.
|
||||
if (auto classDecl = dyn_cast<ClassDecl>(current)) {
|
||||
// If we're looking for initializers, only look at the superclass if the
|
||||
|
||||
Reference in New Issue
Block a user