From 511a4089ca72b55bdc67b6a0c2a650d0bc17195d Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 12 Dec 2019 16:55:00 +0300 Subject: [PATCH] Kotlin/Native IDE plugin clean-up - Drop KotlinNativeMetadataVersion in favor of KlibMetadataVersion - Drop KotlinNativeProtoBasedClassDataFinder in favor of KlibMetadataClassDataFinder --- .../KotlinNativeMetadataDecompiler.kt | 24 ++++---------- ...NativeMetadataDeserializerForDecompiler.kt | 6 ++-- .../KotlinNativeProtoBasedClassDataFinder.kt | 32 ------------------- 3 files changed, 11 insertions(+), 51 deletions(-) delete mode 100644 idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeProtoBasedClassDataFinder.kt diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt index 0db360ec810..9fef4a0c29a 100644 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/decompiler/KotlinNativeMetadataDecompiler.kt @@ -9,15 +9,17 @@ import com.intellij.openapi.fileTypes.FileType import com.intellij.openapi.fileTypes.FileTypeConsumer import com.intellij.openapi.fileTypes.FileTypeFactory import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.backend.common.serialization.metadata.KlibMetadataVersion import org.jetbrains.kotlin.library.KLIB_METADATA_FILE_EXTENSION import org.jetbrains.kotlin.library.metadata.KlibMetadataSerializerProtocol -import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion import org.jetbrains.kotlin.serialization.konan.NullFlexibleTypeDeserializer -class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase( - KotlinNativeMetaFileType, { KlibMetadataSerializerProtocol }, NullFlexibleTypeDeserializer, - { KotlinNativeMetadataVersion.DEFAULT_INSTANCE }, - { KotlinNativeMetadataVersion.INVALID_VERSION }, +class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase( + KotlinNativeMetaFileType, + { KlibMetadataSerializerProtocol }, + NullFlexibleTypeDeserializer, + { KlibMetadataVersion.INSTANCE }, + { KlibMetadataVersion.INVALID_VERSION }, KotlinNativeMetaFileType.STUB_VERSION ) { @@ -27,18 +29,6 @@ class KotlinNativeMetadataDecompiler : KotlinNativeMetadataDecompilerBase SourceElement = { SourceElement.NO_SOURCE } -) : ClassDataFinder { - private val classIdToProto = - proto.class_List.associateBy { klass -> - nameResolver.getClassId(klass.fqName) - } - - internal val allClassIds: Collection get() = classIdToProto.keys - - override fun findClassData(classId: ClassId): ClassData? { - val classProto = classIdToProto[classId] ?: return null - return ClassData(nameResolver, classProto, KotlinNativeMetadataVersion.DEFAULT_INSTANCE, classSource(classId)) - } -}