diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InteropCallableReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InteropCallableReferenceLowering.kt index 7779c4f315b..846a9bed6d8 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InteropCallableReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/InteropCallableReferenceLowering.kt @@ -204,6 +204,7 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo visibility = lambdaClass.visibility returnType = expression.type name = factoryName + origin = FACTORY_ORIGIN } factoryDeclaration.parent = implicitDeclarationFile @@ -231,5 +232,6 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo companion object { object EXPLICIT_INVOKE : IrStatementOriginImpl("EXPLICIT_INVOKE") + object FACTORY_ORIGIN : IrDeclarationOriginImpl("FACTORY_ORIGIN") } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsCodeOutliningLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsCodeOutliningLowering.kt index d47dfbedbb3..ee2f29bd01e 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsCodeOutliningLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/JsCodeOutliningLowering.kt @@ -163,6 +163,7 @@ private class JsCodeOutlineTransformer( name = Name.identifier("outlinedJsCode$") visibility = DescriptorVisibilities.LOCAL returnType = backendContext.dynamicType + origin = OUTLINED_ORIGIN } // We don't need this function's body. Using empty block body stub, because some code might expect all functions to have bodies. outlinedFunction.body = backendContext.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET) @@ -215,4 +216,8 @@ private class JsCodeOutlineTransformer( } } } + + companion object { + object OUTLINED_ORIGIN : IrDeclarationOriginImpl("OUTLINED_ORIGIN") + } } \ No newline at end of file diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt index 6c5ca289b56..c1576b1c85a 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyLazyInitLowering.kt @@ -282,7 +282,7 @@ private fun IrDeclaration.isCompatibleDeclaration() = origin in compatibleOrigins private fun IrDeclaration.assertCompatibleDeclaration() { - assert((this as? PersistentIrElementBase<*>)?.createdOn?.let { it == 0 } != false) + assert(this !is PersistentIrElementBase<*> || createdOn == 0) } private val compatibleOrigins = listOf( diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyReferenceLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyReferenceLowering.kt index 5fab1cebe1d..d0e62fd7326 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyReferenceLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PropertyReferenceLowering.kt @@ -12,10 +12,7 @@ import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.builders.declarations.buildFun import org.jetbrains.kotlin.ir.builders.declarations.buildValueParameter -import org.jetbrains.kotlin.ir.declarations.IrDeclaration -import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl @@ -63,6 +60,7 @@ class PropertyReferenceLowering(private val context: JsIrBackendContext) : BodyL endOffset = reference.endOffset returnType = reference.type name = Name.identifier("${property.name.asString()}\$factory") + origin = PROPERTY_REFERENCE_FACTORY } val boundArguments = listOfNotNull(reference.dispatchReceiver, reference.extensionReceiver) @@ -259,4 +257,8 @@ class PropertyReferenceLowering(private val context: JsIrBackendContext) : BodyL } } } + + companion object { + object PROPERTY_REFERENCE_FACTORY : IrDeclarationOriginImpl("PROPERTY_REFERNCE_FACTORY") + } }