From ed9f5497fbf6c847fdd3ae8a7e43e570a1c317ee Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 10 Jan 2023 19:11:56 +0100 Subject: [PATCH] Native: remove unused code --- .../konan/descriptors/DescriptorUtils.kt | 24 ------------------- .../kotlin/backend/konan/descriptors/utils.kt | 22 ----------------- 2 files changed, 46 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index 3bee9ec526b..7ade71f733b 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.resolve.annotations.argumentValue import org.jetbrains.kotlin.resolve.constants.StringValue -import org.jetbrains.kotlin.resolve.descriptorUtil.module /** * List of all implemented interfaces (including those which implemented by a super class) @@ -237,26 +236,6 @@ internal fun IrSimpleFunction.bridgeDirectionsTo(overriddenFunction: IrSimpleFun fun IrFunctionSymbol.isComparisonFunction(map: Map): Boolean = this in map.values -val IrDeclaration.isPropertyAccessor get() = - this is IrSimpleFunction && this.correspondingPropertySymbol != null - -val IrDeclaration.isPropertyField get() = - this is IrField && this.correspondingPropertySymbol != null - -val IrDeclaration.isTopLevelDeclaration get() = - parent !is IrDeclaration && !this.isPropertyAccessor && !this.isPropertyField - -fun IrDeclaration.findTopLevelDeclaration(): IrDeclaration = when { - this.isTopLevelDeclaration -> - this - this.isPropertyAccessor -> - (this as IrSimpleFunction).correspondingPropertySymbol!!.owner.findTopLevelDeclaration() - this.isPropertyField -> - (this as IrField).correspondingPropertySymbol!!.owner.findTopLevelDeclaration() - else -> - (this.parent as IrDeclaration).findTopLevelDeclaration() -} - internal fun IrClass.isFrozen(context: Context): Boolean { val isLegacyMM = context.memoryModel != MemoryModel.EXPERIMENTAL return when { @@ -300,6 +279,3 @@ fun IrFunction.externalSymbolOrThrow(): String? { } val IrFunction.isBuiltInOperator get() = origin == IrBuiltIns.BUILTIN_OPERATOR - -fun IrDeclaration.isFromMetadataInteropLibrary() = - descriptor.module.isFromInteropLibrary() diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt index 8e0e083c429..5318964a0eb 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/utils.kt @@ -32,33 +32,11 @@ internal val String.synthesizedName get() = Name.identifier(this.synthesizedStri internal val String.synthesizedString get() = "\$$this" -internal val DeclarationDescriptor.propertyIfAccessor - get() = if (this is PropertyAccessorDescriptor) - this.correspondingProperty - else this - internal val CallableMemberDescriptor.propertyIfAccessor get() = if (this is PropertyAccessorDescriptor) this.correspondingProperty else this -internal val FunctionDescriptor.deserializedPropertyIfAccessor: DeserializedCallableMemberDescriptor - get() { - val member = this.propertyIfAccessor - if (member is DeserializedCallableMemberDescriptor) - return member - else - error("Unexpected deserializable callable descriptor") - } - -internal val CallableMemberDescriptor.isDeserializableCallable - get () = (this.propertyIfAccessor is DeserializedCallableMemberDescriptor) - -fun DeclarationDescriptor.findTopLevelDescriptor(): DeclarationDescriptor { - return if (this.containingDeclaration is org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor) this.propertyIfAccessor - else this.containingDeclaration!!.findTopLevelDescriptor() -} - private fun IrDeclaration.findTopLevelDeclaration(): IrDeclaration = when (val parent = this.parent) { is IrDeclaration -> parent.findTopLevelDeclaration() else -> this