JVM IR: Fix corresponding properties in JvmStaticAnnotationLowering
This commit is contained in:
committed by
Alexander Udalov
parent
24b28f80cb
commit
d5c2707c2c
+7
-5
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.common.runOnFilePostfix
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.copyCorrespondingPropertyFrom
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.isInCurrentModule
|
||||
import org.jetbrains.kotlin.backend.jvm.ir.replaceThisByStaticReference
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
@@ -137,14 +138,15 @@ private class SingletonObjectJvmStaticLowering(
|
||||
// dispatch receiver parameter is already null for synthetic property annotation methods
|
||||
jvmStaticFunction.dispatchReceiverParameter?.let { oldDispatchReceiverParameter ->
|
||||
jvmStaticFunction.dispatchReceiverParameter = null
|
||||
modifyBody(jvmStaticFunction, irClass, oldDispatchReceiverParameter)
|
||||
jvmStaticFunction.body = jvmStaticFunction.body?.replaceThisByStaticReference(
|
||||
context.declarationFactory,
|
||||
irClass,
|
||||
oldDispatchReceiverParameter
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun modifyBody(irFunction: IrFunction, irClass: IrClass, oldDispatchReceiverParameter: IrValueParameter) {
|
||||
irFunction.body = irFunction.body?.replaceThisByStaticReference(context.declarationFactory, irClass, oldDispatchReceiverParameter)
|
||||
}
|
||||
}
|
||||
|
||||
private fun IrFunction.isJvmStaticInSingleton(): Boolean {
|
||||
@@ -193,7 +195,7 @@ private class MakeCallsStatic(
|
||||
returnType = this@copyRemovingDispatchReceiver.returnType
|
||||
}.also {
|
||||
it.parent = parent
|
||||
it.correspondingPropertySymbol = correspondingPropertySymbol
|
||||
it.copyCorrespondingPropertyFrom(this)
|
||||
it.annotations += annotations
|
||||
it.copyParameterDeclarationsFrom(this)
|
||||
it.dispatchReceiverParameter = null
|
||||
|
||||
Reference in New Issue
Block a user