JVM_IR: refactor MoveCompanionObjectFieldsLowering
* Extract replacement of IrGetField/IrSetField into a separate file-level lowering (should reduce the amount of work to linear in the number of classes rather than potentially quadratic) * Extract static backing field construction into JvmDeclarationFactory and move that lowering after PropertiesToFields lowering to reduce code duplication
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: box.kt
|
||||
fun box(): String = Z.result
|
||||
|
||||
// FILE: z.kt
|
||||
object Z {
|
||||
@JvmField
|
||||
val result: String = "OK"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: box.kt
|
||||
fun box(): String = A.result
|
||||
|
||||
object A {
|
||||
@JvmField
|
||||
val result: String
|
||||
|
||||
init { result = Z.result }
|
||||
}
|
||||
|
||||
// FILE: z.kt
|
||||
object Z {
|
||||
@JvmField
|
||||
val result: String = "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user