mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Clarify semantics of getImportedModules.
The lack of clarity manifested as unexpected behavior when using getImportedModules to create the module import graph. The new behavior makes SPI-ness and Shadowing-ness behave similarly in terms of filtering. We also check if a filter is well-formed to avoid accidental empty import lists.
This commit is contained in:
@@ -175,6 +175,7 @@ ImportSet &ImportCache::getImportSet(const DeclContext *dc) {
|
||||
ModuleDecl::ImportedModule{ImportPath::Access(), mod});
|
||||
|
||||
if (file) {
|
||||
// Should include both SPI & non-SPI.
|
||||
file->getImportedModules(imports,
|
||||
{ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::ImplementationOnly,
|
||||
@@ -260,6 +261,7 @@ ImportCache::getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
|
||||
ModuleDecl::ImportedModule{ImportPath::Access(), currentMod});
|
||||
|
||||
if (auto *file = dyn_cast<FileUnit>(dc)) {
|
||||
// Should include both SPI & non-SPI
|
||||
file->getImportedModules(stack,
|
||||
{ModuleDecl::ImportFilterKind::Default,
|
||||
ModuleDecl::ImportFilterKind::ImplementationOnly,
|
||||
|
||||
Reference in New Issue
Block a user