Files
kotlin/compiler/testData/codegen/bytecodeText/constProperty/accessorsForPrivateConstants.kt
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

21 lines
410 B
Kotlin
Vendored

// LANGUAGE_VERSION: 1.0
// FILE: Foo.kt
private const val OUTER_PRIVATE = 20
class Foo {
companion object {
private const val LOCAL_PRIVATE = 20
}
fun foo() {
// Access to the property use getstatic on the backed field
LOCAL_PRIVATE
// Access to the property requires an invokestatic
OUTER_PRIVATE
}
}
// 1 INVOKESTATIC
// 1 PUTSTATIC
// 2 GETSTATIC