From 92e3d56042d34cb64d672aa7099fe72831ed849f Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Thu, 1 Sep 2022 17:21:56 +0300 Subject: Add `DynamicTypeDeserializer` (#2645) --- .../analysis/resolve/DokkaJsResolverForModuleFactory.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'kotlin-analysis/src/main/kotlin') diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/resolve/DokkaJsResolverForModuleFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/resolve/DokkaJsResolverForModuleFactory.kt index 93214592..353c71fb 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/resolve/DokkaJsResolverForModuleFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/resolve/DokkaJsResolverForModuleFactory.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.analysis.resolve import org.jetbrains.kotlin.analyzer.* -import org.jetbrains.kotlin.builtins.konan.KonanBuiltIns +import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.container.StorageComponentContainer import org.jetbrains.kotlin.container.get @@ -14,14 +14,15 @@ import org.jetbrains.kotlin.idea.klib.createKlibPackageFragmentProvider import org.jetbrains.kotlin.incremental.components.LookupTracker import org.jetbrains.kotlin.js.resolve.JsPlatformAnalyzerServices import org.jetbrains.kotlin.konan.util.KlibMetadataFactories -import org.jetbrains.kotlin.library.metadata.NullFlexibleTypeDeserializer import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer import org.jetbrains.kotlin.resolve.SealedClassInheritorsProvider import org.jetbrains.kotlin.resolve.TargetEnvironment import org.jetbrains.kotlin.resolve.lazy.ResolveSession import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactoryService +import org.jetbrains.kotlin.serialization.js.DynamicTypeDeserializer import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil import org.jetbrains.kotlin.serialization.js.createKotlinJavascriptPackageFragmentProvider +import org.jetbrains.kotlin.serialization.konan.impl.KlibMetadataModuleDescriptorFactoryImpl import org.jetbrains.kotlin.utils.KotlinJavascriptMetadataUtils import java.io.File @@ -30,7 +31,14 @@ internal class DokkaJsResolverForModuleFactory( private val targetEnvironment: TargetEnvironment ) : ResolverForModuleFactory() { companion object { - private val metadataFactories = KlibMetadataFactories(::KonanBuiltIns, NullFlexibleTypeDeserializer) + private val metadataFactories = KlibMetadataFactories({ DefaultBuiltIns.Instance }, DynamicTypeDeserializer) + + private val metadataModuleDescriptorFactory = KlibMetadataModuleDescriptorFactoryImpl( + metadataFactories.DefaultDescriptorFactory, + metadataFactories.DefaultPackageFragmentsFactory, + metadataFactories.flexibleTypeDeserializer, + metadataFactories.platformDependentTypeTransformer + ) } override fun createResolverForModule( @@ -82,7 +90,7 @@ internal class DokkaJsResolverForModuleFactory( moduleInfo.kotlinLibrary .createKlibPackageFragmentProvider( storageManager = moduleContext.storageManager, - metadataModuleDescriptorFactory = metadataFactories.DefaultDeserializedDescriptorFactory, + metadataModuleDescriptorFactory = metadataModuleDescriptorFactory, languageVersionSettings = languageVersionSettings, moduleDescriptor = moduleDescriptor, lookupTracker = LookupTracker.DO_NOTHING -- cgit