From 6729603ac76e70e78e79744dfae64f2c96c4fae7 Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Thu, 25 Apr 2019 15:11:02 +0300 Subject: [PATCH] [JS IR BE] Fix warnings --- .../ir/backend/js/lower/BridgesConstruction.kt | 2 +- .../backend/js/lower/CallableReferenceLowering.kt | 4 ++-- .../ir/backend/js/lower/PrivateMembersLowering.kt | 2 +- .../js/lower/ThrowableSuccessorsLowering.kt | 2 +- .../ir/backend/js/lower/inline/FunctionInlining.kt | 14 ++++++++------ .../js/transformers/irToJs/JsClassGenerator.kt | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt index 62da811ec37..a05e16f888a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/BridgesConstruction.kt @@ -80,7 +80,7 @@ class BridgesConstruction(val context: JsIrBackendContext) : ClassLoweringPass { continue } - if (from.function.correspondingProperty != null && from.function.isEffectivelyExternal()) { + if (from.function.correspondingPropertySymbol != null && from.function.isEffectivelyExternal()) { // TODO: Revisit bridges from external properties continue } 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 c4e47c95c22..b2d8e319d2f 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 @@ -201,7 +201,7 @@ class CallableReferenceLowering(val context: JsIrBackendContext) : FileLoweringP // } val arity = propertyReference.type.arity - val factoryName = createPropertyFactoryName(getterDeclaration.correspondingProperty!!) + val factoryName = createPropertyFactoryName(getterDeclaration.correspondingPropertySymbol!!.owner) val factoryFunction = buildFactoryFunction(propertyReference.getter!!.owner, propertyReference, factoryName) val getterFunction = propertyReference.getter?.let { buildClosureFunction(it.owner, factoryFunction, propertyReference, arity) }!! @@ -243,7 +243,7 @@ class CallableReferenceLowering(val context: JsIrBackendContext) : FileLoweringP putValueArgument( 2, JsIrBuilder.buildString( context.irBuiltIns.stringType, - getReferenceName(getterDeclaration.correspondingProperty!!) + getReferenceName(getterDeclaration.correspondingPropertySymbol!!.owner) ) ) } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrivateMembersLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrivateMembersLowering.kt index ee4325476db..ab8339e97d7 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrivateMembersLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PrivateMembersLowering.kt @@ -150,7 +150,7 @@ class PrivateMembersLowering(val context: JsIrBackendContext) : ClassLoweringPas ).also { descriptor.bind(it) it.parent = parent - it.correspondingProperty = correspondingProperty + it.correspondingPropertySymbol = correspondingPropertySymbol } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableSuccessorsLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableSuccessorsLowering.kt index 727575257de..f8cc4e75301 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableSuccessorsLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/ThrowableSuccessorsLowering.kt @@ -199,7 +199,7 @@ class ThrowableSuccessorsLowering(val context: JsIrBackendContext) : FileLowerin val name = fakeAccessor.name val function = JsIrBuilder.buildFunction(name, fakeAccessor.returnType, fakeAccessor.parent).apply { overriddenSymbols += fakeAccessor.overriddenSymbols - correspondingProperty = fakeAccessor.correspondingProperty + correspondingPropertySymbol = fakeAccessor.correspondingPropertySymbol dispatchReceiverParameter = fakeAccessor.dispatchReceiverParameter?.copyTo(this) } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/inline/FunctionInlining.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/inline/FunctionInlining.kt index 4949446f0ed..e72928d319a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/inline/FunctionInlining.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/inline/FunctionInlining.kt @@ -77,10 +77,10 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW } private fun getFunctionDeclaration(symbol: IrFunctionSymbol): IrFunction { - val descriptor = symbol.descriptor.original - val languageVersionSettings = context.configuration.languageVersionSettings - // TODO: Remove these hacks when coroutine intrinsics are fixed. - return when { +// val descriptor = symbol.descriptor.original +// val languageVersionSettings = context.configuration.languageVersionSettings +// // TODO: Remove these hacks when coroutine intrinsics are fixed. +// return when { // descriptor.isBuiltInIntercepted(languageVersionSettings) -> // error("Continuation.intercepted is not available with release coroutines") // @@ -89,9 +89,11 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW // // descriptor == context.ir.symbols.coroutineContextGetter -> // context.ir.symbols.konanCoroutineContextGetter.owner +// +// else -> (symbol.owner as? IrSimpleFunction)?.resolveFakeOverride() ?: symbol.owner +// } - else -> (symbol.owner as? IrSimpleFunction)?.resolveFakeOverride() ?: symbol.owner - } + return (symbol.owner as? IrSimpleFunction)?.resolveFakeOverride() ?: symbol.owner } private val inlineConstructor = FqName("kotlin.native.internal.InlineConstructor") diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/JsClassGenerator.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/JsClassGenerator.kt index 130ed2a6df0..ee92f4378d6 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/JsClassGenerator.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/transformers/irToJs/JsClassGenerator.kt @@ -54,7 +54,7 @@ class JsClassGenerator(private val irClass: IrClass, val context: JsGenerationCo classModel.preDeclarationBlock.statements += generateInheritanceCode() } is IrSimpleFunction -> { - properties.addIfNotNull(declaration.correspondingProperty) + properties.addIfNotNull(declaration.correspondingPropertySymbol?.owner) generateMemberFunction(declaration)?.let { classBlock.statements += it } } is IrClass -> {