mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Use direct field access to trivial class properties
#KT-3845 Fixed
This commit is contained in:
@@ -10,7 +10,7 @@ class A {
|
||||
|
||||
class B {
|
||||
var foo = 1
|
||||
private set
|
||||
private set(value) { $foo = value }
|
||||
|
||||
fun foo() {
|
||||
foo = 2
|
||||
|
||||
41
compiler/testData/codegen/bytecodeText/kt3845.kt
Normal file
41
compiler/testData/codegen/bytecodeText/kt3845.kt
Normal file
@@ -0,0 +1,41 @@
|
||||
class Example
|
||||
{
|
||||
var a1 = 0
|
||||
|
||||
public var a2: Int = 0
|
||||
|
||||
private var a3 = 0
|
||||
|
||||
|
||||
var b1 = 0
|
||||
private set
|
||||
|
||||
var b2 = 0
|
||||
internal set
|
||||
|
||||
var b3 = 0
|
||||
set
|
||||
|
||||
public var b4: Int = 0
|
||||
public set
|
||||
|
||||
private var b5 = 0
|
||||
private set
|
||||
|
||||
|
||||
{
|
||||
a1 = 1
|
||||
a2 = 1
|
||||
a3 = 1
|
||||
|
||||
b1 = 1
|
||||
b2 = 1
|
||||
b3 = 1
|
||||
b4 = 1
|
||||
b5 = 1
|
||||
}
|
||||
}
|
||||
|
||||
// Every property should be accessed directly in this example because they all are final class properties with default accessors
|
||||
// 0 INVOKESPECIAL Example\.set
|
||||
// 0 INVOKEVIRTUAL Example\.set
|
||||
Reference in New Issue
Block a user