mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Move lookupQualified from Module to DeclContext.
Qualified lookup depends not only on the current module but actually the current file, since imports are file-scoped by default. Currently this only affects lookup into other modules (e.g. "Foundation.NSString"), but this could also be used for extension filtering. This breaks one name resolution test, but the refactoring in the next commit changes everything anyway and will restore the test. Swift SVN r10831
This commit is contained in:
@@ -1114,6 +1114,20 @@ void Module::forAllVisibleModules(Optional<AccessPathTy> thisPath,
|
||||
forAllImportedModules<true>(this, thisPath, fn);
|
||||
}
|
||||
|
||||
void
|
||||
FileUnit::forAllVisibleModules(std::function<bool(Module::ImportedModule)> fn) {
|
||||
getParentModule()->forAllVisibleModules(Module::AccessPathTy(), fn);
|
||||
|
||||
if (auto SF = dyn_cast<SourceFile>(this)) {
|
||||
// Handle privately visible modules as well.
|
||||
for (auto importPair : SF->getImports()) {
|
||||
if (!importPair.second)
|
||||
importPair.first.second->forAllVisibleModules(importPair.first.first,
|
||||
fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Module::collectLinkLibraries(LinkLibraryCallback callback) {
|
||||
forAllImportedModules<false>(this, AccessPathTy(),
|
||||
[=](ImportedModule import) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user