Files
kotlin-fork/compiler/testData/codegen/bytecodeText/companion/kt14258_5.kt
T
Mikaël Peltier d0ed0c4049 KT-14258 Optimize accesses to properties defined into companion
- Use direct access to property defined into companion object when
it is possible rather than always use an accessor to access the
property.
- Use direct access will speedup runtime performance.
- Avoid to generate useless accessors for companion properties.

Fix of https://youtrack.jetbrains.com/issue/KT-14258
2018-03-14 15:30:40 +01:00

19 lines
511 B
Kotlin
Vendored

// Checks that accessor are not used because property can be accessed directly.
interface I {
companion object {
private var bar = "Companion Field from I"
fun test(): String {
bar = "New value"
return bar
}
}
}
// 1 GETSTATIC I\$Companion.bar
// 2 PUTSTATIC I\$Companion.bar
// 0 INVOKESTATIC I\$Companion.access\$getBar\$p
// 0 INVOKESTATIC I\$Companion.access\$setBar\$cp
// 0 INVOKESPECIAL I\$Companion.getBar
// 0 INVOKESPECIAL I\$Companion.setBar