Sema: Small NFC cleanup for LookupResultBuilder::add()

This commit is contained in:
Slava Pestov
2017-07-27 23:22:58 -07:00
parent f51a9d022c
commit bfb252ab39

View File

@@ -129,6 +129,12 @@ namespace {
assert(isa<ProtocolDecl>(foundDC)); assert(isa<ProtocolDecl>(foundDC));
if (!Options.contains(NameLookupFlags::PerformConformanceCheck))
return;
// If we found something within the protocol itself, and our
// search began somewhere that is not in a protocol or extension
// thereof, remap this declaration to the witness.
auto conformingType = foundInType; auto conformingType = foundInType;
// When performing a lookup on a subclass existential, we might // When performing a lookup on a subclass existential, we might
@@ -143,10 +149,6 @@ namespace {
conformingType = layout.superclass; conformingType = layout.superclass;
} }
// If we found something within the protocol itself, and our
// search began somewhere that is not in a protocol or extension
// thereof, remap this declaration to the witness.
if (Options.contains(NameLookupFlags::PerformConformanceCheck)) {
// Dig out the protocol conformance. // Dig out the protocol conformance.
auto conformance = TC.conformsToProtocol(conformingType, foundProto, DC, auto conformance = TC.conformsToProtocol(conformingType, foundProto, DC,
conformanceOptions); conformanceOptions);
@@ -184,9 +186,6 @@ namespace {
// the requirement, so just drop the lookup result here. // the requirement, so just drop the lookup result here.
if (witness && !isa<ProtocolDecl>(witness->getDeclContext())) if (witness && !isa<ProtocolDecl>(witness->getDeclContext()))
addResult(witness); addResult(witness);
return;
}
} }
}; };
} // end anonymous namespace } // end anonymous namespace