mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Refactor superfluous public import tracking.
In anticipation of reusing minimum access level information for diagnostics related to the `MemberImportVisibility` feature, refactor the way the type checker tracks the modules which must be imported publicly. Recording minimum access levels is no longer restricted to modules that are already imported in a source file since `MemberImportVisibility` diagnostics will need this information when emitting fix-its for modules that are not already imported. Unblocks rdar://126637855.
This commit is contained in:
@@ -2728,10 +2728,8 @@ SourceFile::getMaxAccessLevelUsingImport(
|
||||
return known->second;
|
||||
}
|
||||
|
||||
void SourceFile::registerAccessLevelUsingImport(
|
||||
AttributedImport<ImportedModule> import,
|
||||
AccessLevel accessLevel) {
|
||||
auto mod = import.module.importedModule;
|
||||
void SourceFile::registerRequiredAccessLevelForModule(ModuleDecl *mod,
|
||||
AccessLevel accessLevel) {
|
||||
auto known = ImportsUseAccessLevel.find(mod);
|
||||
if (known == ImportsUseAccessLevel.end())
|
||||
ImportsUseAccessLevel[mod] = accessLevel;
|
||||
@@ -2754,7 +2752,7 @@ void SourceFile::registerAccessLevelUsingImport(
|
||||
auto otherImportModName = otherImportMod->getName();
|
||||
if (otherImportMod == declaringMod ||
|
||||
llvm::find(bystanders, otherImportModName) != bystanders.end()) {
|
||||
registerAccessLevelUsingImport(otherImport, accessLevel);
|
||||
registerRequiredAccessLevelForModule(otherImportMod, accessLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user