mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: Replace ModuleDecl::ImportFilter math with explicit switch statements
This one is particularly obnoxious.
This commit is contained in:
@@ -1591,9 +1591,26 @@ void ModuleFile::getImportedModules(
|
||||
PrettyStackTraceModuleFile stackEntry(*this);
|
||||
|
||||
for (auto &dep : Dependencies) {
|
||||
if (filter != ModuleDecl::ImportFilter::All &&
|
||||
(filter == ModuleDecl::ImportFilter::Public) ^ dep.isExported())
|
||||
continue;
|
||||
switch (filter) {
|
||||
case ModuleDecl::ImportFilter::All:
|
||||
// We're including all imports.
|
||||
break;
|
||||
|
||||
case ModuleDecl::ImportFilter::Private:
|
||||
// Skip @_exported imports.
|
||||
if (dep.isExported())
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
||||
case ModuleDecl::ImportFilter::Public:
|
||||
// Only include @_exported imports.
|
||||
if (!dep.isExported())
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
assert(dep.isLoaded());
|
||||
results.push_back(dep.Import);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user