From 4381a2d81bdfe95592b7499efc1f54a3671616b1 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Tue, 3 Mar 2020 18:52:58 +0300 Subject: [PATCH] [JS IR] Clean up callable reference lowering --- .../ir/backend/js/lower/CallableReferenceLowering.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt index a90df784304..dbcac3513d0 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/CallableReferenceLowering.kt @@ -105,14 +105,13 @@ class CallableReferenceLowering(private val context: CommonBackendContext) : Bod private val isLambda: Boolean ) { - private val isKReference: Boolean get() = superFunctionInterface.name.identifier[0] == 'K' - private val isSuspendLambda = isLambda && function.isSuspend - private val superClass = if (isSuspendLambda) context.ir.symbols.coroutineImpl.owner.defaultType else context.irBuiltIns.anyType + private val superClass = if (isSuspendLambda) context.ir.symbols.coroutineImpl.owner.defaultType else context.irBuiltIns.anyType private var boundReceiverField: IrField? = null private val superFunctionInterface = reference.type.classOrNull?.owner ?: error("Expected functional type") + private val isKReference = superFunctionInterface.name.identifier[0] == 'K' private fun buildReferenceClass(): IrClass { return buildClass { @@ -303,8 +302,6 @@ class CallableReferenceLowering(private val context: CommonBackendContext) : Bod private fun createNameProperty(clazz: IrClass) { if (!isKReference) return -// if (superFunctionInterface.name.identifier[0] != 'K') return - val superProperty = superFunctionInterface.declarations.filterIsInstance().single() val supperGetter = superProperty.getter ?: error("Expected getter for KFunction.name property")