Pass DynamicLookupInfo through VisibleDeclConsumers NFC

This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
This commit is contained in:
Ben Langmuir
2019-05-01 14:28:07 -07:00
parent f5ba89d372
commit 34da079aa6
14 changed files with 318 additions and 164 deletions

View File

@@ -298,7 +298,8 @@ void SourceLookupCache::lookupClassMembers(AccessPathTy accessPath,
for (ValueDecl *vd : member.second) {
auto *nominal = vd->getDeclContext()->getSelfNominalTypeDecl();
if (nominal && nominal->getName() == accessPath.front().first)
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup);
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup,
DynamicLookupInfo::AnyObject);
}
}
return;
@@ -311,7 +312,8 @@ void SourceLookupCache::lookupClassMembers(AccessPathTy accessPath,
continue;
for (ValueDecl *vd : member.second)
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup);
consumer.foundDecl(vd, DeclVisibilityKind::DynamicLookup,
DynamicLookupInfo::AnyObject);
}
}