[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:
Doug Gregor
2016-09-19 21:19:55 -07:00
parent 0289020427
commit 8ab9989c5f
3 changed files with 9 additions and 25 deletions

View File

@@ -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