From cfb97536d2159c0b73f220b8ae537ee529844336 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 7 Oct 2019 01:08:51 +0300 Subject: [PATCH] Commonized SourceMap with FileRegistry --- .../descriptors/LegacyDescriptorUtils.kt | 24 ------------------- .../objcexport/ObjCExportHeaderGenerator.kt | 1 + 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/LegacyDescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/LegacyDescriptorUtils.kt index 2c735fbeb53..056fa33eeb9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/LegacyDescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/LegacyDescriptorUtils.kt @@ -160,28 +160,4 @@ internal val DeclarationDescriptor.isExpectMember: Boolean internal val DeclarationDescriptor.isSerializableExpectClass: Boolean get() = this is ClassDescriptor && ExpectedActualDeclarationChecker.shouldGenerateExpectClass(this) -// TODO: temporary disabling. Need to figure out proper SourceFileMap and FileRegistry commonization. -//private fun sourceByIndex(descriptor: CallableMemberDescriptor, index: Int): SourceFile { -// val fragment = descriptor.findPackage() as KonanPackageFragment -// return fragment.sourceFileMap.sourceFile(index) -//} - -fun CallableMemberDescriptor.findSourceFile(): SourceFile { - val source = this.source.containingFile - if (source != SourceFile.NO_SOURCE_FILE) - return source - return when { - // TODO: temporary disabling. Need to figure out proper SourceFileMap and FileRegistry commonization. - this is DeserializedSimpleFunctionDescriptor && proto.hasExtension(KlibMetadataProtoBuf.functionFile) -> - SourceFile.NO_SOURCE_FILE - //sourceByIndex( - // this, proto.getExtension(KlibMetadataProtoBuf.functionFile)) - this is DeserializedPropertyDescriptor && proto.hasExtension(KlibMetadataProtoBuf.propertyFile) -> - SourceFile.NO_SOURCE_FILE - //sourceByIndex( - // this, proto.getExtension(KlibMetadataProtoBuf.propertyFile)) - else -> TODO() - } -} - val ModuleDescriptor.konanLibrary get() = (this.klibModuleOrigin as? DeserializedKlibModuleOrigin)?.library diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt index 10000052e4d..430e23795e0 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.backend.konan.objcexport +import org.jetbrains.kotlin.backend.common.serialization.findSourceFile import org.jetbrains.kotlin.backend.konan.* import org.jetbrains.kotlin.backend.konan.descriptors.* import org.jetbrains.kotlin.builtins.KotlinBuiltIns