mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
- 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
21 lines
410 B
Kotlin
Vendored
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 |