JS IR: special origins for declaration created during lowerings
Otherwise the lazy properties lowering may try to process them
This commit is contained in:
+2
@@ -204,6 +204,7 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
|
|||||||
visibility = lambdaClass.visibility
|
visibility = lambdaClass.visibility
|
||||||
returnType = expression.type
|
returnType = expression.type
|
||||||
name = factoryName
|
name = factoryName
|
||||||
|
origin = FACTORY_ORIGIN
|
||||||
}
|
}
|
||||||
|
|
||||||
factoryDeclaration.parent = implicitDeclarationFile
|
factoryDeclaration.parent = implicitDeclarationFile
|
||||||
@@ -231,5 +232,6 @@ class InteropCallableReferenceLowering(val context: JsIrBackendContext) : BodyLo
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
object EXPLICIT_INVOKE : IrStatementOriginImpl("EXPLICIT_INVOKE")
|
object EXPLICIT_INVOKE : IrStatementOriginImpl("EXPLICIT_INVOKE")
|
||||||
|
object FACTORY_ORIGIN : IrDeclarationOriginImpl("FACTORY_ORIGIN")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -163,6 +163,7 @@ private class JsCodeOutlineTransformer(
|
|||||||
name = Name.identifier("outlinedJsCode$")
|
name = Name.identifier("outlinedJsCode$")
|
||||||
visibility = DescriptorVisibilities.LOCAL
|
visibility = DescriptorVisibilities.LOCAL
|
||||||
returnType = backendContext.dynamicType
|
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.
|
// 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)
|
outlinedFunction.body = backendContext.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET)
|
||||||
@@ -215,4 +216,8 @@ private class JsCodeOutlineTransformer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
object OUTLINED_ORIGIN : IrDeclarationOriginImpl("OUTLINED_ORIGIN")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -282,7 +282,7 @@ private fun IrDeclaration.isCompatibleDeclaration() =
|
|||||||
origin in compatibleOrigins
|
origin in compatibleOrigins
|
||||||
|
|
||||||
private fun IrDeclaration.assertCompatibleDeclaration() {
|
private fun IrDeclaration.assertCompatibleDeclaration() {
|
||||||
assert((this as? PersistentIrElementBase<*>)?.createdOn?.let { it == 0 } != false)
|
assert(this !is PersistentIrElementBase<*> || createdOn == 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val compatibleOrigins = listOf(
|
private val compatibleOrigins = listOf(
|
||||||
|
|||||||
+6
-4
@@ -12,10 +12,7 @@ import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
|
|||||||
import org.jetbrains.kotlin.ir.builders.*
|
import org.jetbrains.kotlin.ir.builders.*
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
import org.jetbrains.kotlin.ir.builders.declarations.buildFun
|
||||||
import org.jetbrains.kotlin.ir.builders.declarations.buildValueParameter
|
import org.jetbrains.kotlin.ir.builders.declarations.buildValueParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
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.expressions.*
|
import org.jetbrains.kotlin.ir.expressions.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
|
||||||
@@ -63,6 +60,7 @@ class PropertyReferenceLowering(private val context: JsIrBackendContext) : BodyL
|
|||||||
endOffset = reference.endOffset
|
endOffset = reference.endOffset
|
||||||
returnType = reference.type
|
returnType = reference.type
|
||||||
name = Name.identifier("${property.name.asString()}\$factory")
|
name = Name.identifier("${property.name.asString()}\$factory")
|
||||||
|
origin = PROPERTY_REFERENCE_FACTORY
|
||||||
}
|
}
|
||||||
|
|
||||||
val boundArguments = listOfNotNull(reference.dispatchReceiver, reference.extensionReceiver)
|
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")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user