From 6d0b936639fa9d3d511b58a2faca5ba70f9da336 Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Tue, 15 Aug 2023 12:36:15 +0200 Subject: [PATCH] [Native] Make `KonanInteropModuleDeserializer` nested instead of inner --- .../konan/serialization/KonanIrLinker.kt | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrLinker.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrLinker.kt index 9394ce29c0f..9c1f31f7a39 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrLinker.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/serialization/KonanIrLinker.kt @@ -506,7 +506,15 @@ internal class KonanIrLinker( error("Expecting kotlin library for $moduleDescriptor") } klib.isInteropLibrary() -> { - KonanInteropModuleDeserializer(moduleDescriptor, klib, cachedLibraries.isLibraryCached(klib)) + KonanInteropModuleDeserializer( + moduleDescriptor, + klib, + listOfNotNull(forwardDeclarationDeserializer), + cachedLibraries.isLibraryCached(klib), + cenumsProvider, + stubGenerator, + builtIns + ) } else -> { val deserializationStrategy = when { @@ -549,10 +557,14 @@ internal class KonanIrLinker( else -> error("Unknown package fragment kind ${packageFragment::class.java}") } - private inner class KonanInteropModuleDeserializer( + private class KonanInteropModuleDeserializer( moduleDescriptor: ModuleDescriptor, override val klib: KotlinLibrary, - private val isLibraryCached: Boolean + override val moduleDependencies: Collection, + private val isLibraryCached: Boolean, + private val cenumsProvider: IrProviderForCEnumAndCStructStubs, + private val stubGenerator: DeclarationStubGenerator, + private val builtIns: IrBuiltIns, ) : IrModuleDeserializer(moduleDescriptor, klib.versions.abiVersion ?: KotlinAbiVersion.CURRENT) { init { require(klib.isInteropLibrary()) @@ -604,7 +616,6 @@ internal class KonanIrLinker( override fun deserializedSymbolNotFound(idSig: IdSignature): Nothing = error("No descriptor found for $idSig") override val moduleFragment: IrModuleFragment = IrModuleFragmentImpl(moduleDescriptor, builtIns) - override val moduleDependencies: Collection = listOfNotNull(forwardDeclarationDeserializer) override val kind get() = IrModuleDeserializerKind.DESERIALIZED }