[Commonizer] Fix: Keep fwd declarations under real names in CirForwardDeclarations cache
This commit is contained in:
@@ -23,7 +23,6 @@ interface ModulesProvider {
|
||||
)
|
||||
|
||||
class CInteropModuleAttributes(
|
||||
val mainPackageFqName: String,
|
||||
val exportForwardDeclarations: Collection<String>
|
||||
)
|
||||
|
||||
|
||||
+1
-5
@@ -45,11 +45,7 @@ internal abstract class NativeDistributionModulesProvider(libraries: Collection<
|
||||
val dependencies = manifestData.dependencies.toSet()
|
||||
|
||||
val cInteropAttributes = if (manifestData.isInterop) {
|
||||
val packageFqName = manifestData.packageFqName
|
||||
?: manifestData.shortName?.let { "platform.$it" }
|
||||
?: manifestData.uniqueName.substringAfter("platform.").let { "platform.$it" }
|
||||
|
||||
CInteropModuleAttributes(packageFqName, manifestData.exportForwardDeclarations)
|
||||
CInteropModuleAttributes(manifestData.exportForwardDeclarations)
|
||||
} else null
|
||||
|
||||
libraryMap.put(name, library)?.let { error("Duplicated libraries: $name") }
|
||||
|
||||
+3
-2
@@ -253,12 +253,13 @@ class CirTreeMerger(
|
||||
private fun processCInteropModuleAttributes(moduleInfo: ModuleInfo) {
|
||||
val cInteropAttributes = moduleInfo.cInteropAttributes ?: return
|
||||
val exportForwardDeclarations = cInteropAttributes.exportForwardDeclarations.takeIf { it.isNotEmpty() } ?: return
|
||||
val mainPackageFqName = CirPackageName.create(cInteropAttributes.mainPackageFqName)
|
||||
|
||||
exportForwardDeclarations.forEach { classFqName ->
|
||||
// Class has synthetic package FQ name (cnames/objcnames). Need to transfer it to the main package.
|
||||
val packageName = CirPackageName.create(classFqName.substringBeforeLast('.', missingDelimiterValue = ""))
|
||||
val className = CirName.create(classFqName.substringAfterLast('.'))
|
||||
classifiers.forwardDeclarations.addExportedForwardDeclaration(CirEntityId.create(mainPackageFqName, className))
|
||||
|
||||
classifiers.forwardDeclarations.addExportedForwardDeclaration(CirEntityId.create(packageName, className))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ interface CirForwardDeclarations {
|
||||
override fun isExportedForwardDeclaration(classId: CirEntityId) = classId in exportedForwardDeclarations
|
||||
|
||||
override fun addExportedForwardDeclaration(classId: CirEntityId) {
|
||||
check(!classId.packageName.isUnderKotlinNativeSyntheticPackages)
|
||||
check(classId.packageName.isUnderKotlinNativeSyntheticPackages)
|
||||
exportedForwardDeclarations += classId
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user