mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Include inner class members in dynamic lookup results.
Per discussion with Doug, there's no reason why this should not work:
class Outer {
class Inner {
func extract() { ... }
}
}
var obj : DynamicLookup = ...
obj.extract!()
Swift SVN r7763
This commit is contained in:
@@ -588,8 +588,10 @@ void ModuleFile::lookupClassMember(Module::AccessPathTy accessPath,
|
||||
if (!accessPath.empty()) {
|
||||
for (auto item : *iter) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
Type ty = vd->getDeclContext()->getDeclaredTypeOfContext();
|
||||
if (auto nominal = ty->getAnyNominal())
|
||||
auto dc = vd->getDeclContext();
|
||||
while (!dc->getParent()->isModuleContext())
|
||||
dc = dc->getParent();
|
||||
if (auto nominal = dc->getDeclaredTypeInContext()->getAnyNominal())
|
||||
if (nominal->getName() == accessPath.front().first)
|
||||
results.push_back(vd);
|
||||
}
|
||||
@@ -614,8 +616,10 @@ void ModuleFile::lookupClassMembers(Module::AccessPathTy accessPath,
|
||||
ClassMembersByName->data_end())) {
|
||||
for (auto item : list) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
Type ty = vd->getDeclContext()->getDeclaredTypeOfContext();
|
||||
if (auto nominal = ty->getAnyNominal())
|
||||
auto dc = vd->getDeclContext();
|
||||
while (!dc->getParent()->isModuleContext())
|
||||
dc = dc->getParent();
|
||||
if (auto nominal = dc->getDeclaredTypeInContext()->getAnyNominal())
|
||||
if (nominal->getName() == accessPath.front().first)
|
||||
consumer.foundDecl(vd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user