mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Move some package-only import logic from writer to reader
Let's centralize the logic deciding if we load a transitive dependency on the client side and have the producer write the truth in the swiftmodule.
This commit is contained in:
@@ -1694,6 +1694,8 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
|
||||
return ModuleLoadingBehavior::Required;
|
||||
}
|
||||
|
||||
bool moduleIsResilient = getResilienceStrategy() ==
|
||||
ResilienceStrategy::Resilient;
|
||||
if (dependency.isImplementationOnly()) {
|
||||
// Implementation-only dependencies are not usually loaded from
|
||||
// transitive imports.
|
||||
@@ -1712,7 +1714,8 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
|
||||
if (dependency.isPackageOnly()) {
|
||||
// Package dependencies are usually loaded only for import from the same
|
||||
// package.
|
||||
if (!packageName.empty() && packageName == getModulePackageName()) {
|
||||
if ((!packageName.empty() && packageName == getModulePackageName()) ||
|
||||
!moduleIsResilient) {
|
||||
return ModuleLoadingBehavior::Required;
|
||||
} else if (debuggerMode) {
|
||||
return ModuleLoadingBehavior::Optional;
|
||||
|
||||
Reference in New Issue
Block a user