Properties without accessors are generated as

IrGetBackingField / IrSetBackingField expressions.
This commit is contained in:
Dmitry Petrov
2016-09-05 15:06:38 +03:00
committed by Dmitry Petrov
parent a1ad828ea8
commit ceeccfa1b7
40 changed files with 359 additions and 122 deletions
@@ -4,9 +4,11 @@ FILE /argumentReorderingInDelegatingConstructorCall.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public open class Base type=Base
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public open class Base type=Base
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Base
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
+4 -2
View File
@@ -6,9 +6,11 @@ FILE /classMembers.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class C type=C
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD z type=kotlin.Unit operator=null
GET_VAR z type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class C type=C
value: GET_VAR z type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
+6 -3
View File
@@ -4,11 +4,14 @@ FILE /dataClasses.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final data class Test1 type=Test1
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.String operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final data class Test1 type=Test1
value: GET_VAR y type=kotlin.String operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD z type=kotlin.Unit operator=null
GET_VAR z type=kotlin.Any operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final data class Test1 type=Test1
value: GET_VAR z type=kotlin.Any operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
+6 -3
View File
@@ -17,7 +17,8 @@ FILE /enum.kt
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final enum class TestEnum2 : kotlin.Enum<TestEnum2> type=TestEnum2
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum2
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
@@ -61,7 +62,8 @@ FILE /enum.kt
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final enum class TestEnum4 : kotlin.Enum<TestEnum4> type=TestEnum4
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestEnum4
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
@@ -90,7 +92,8 @@ FILE /enum.kt
ANONYMOUS_INITIALIZER TEST2
BLOCK_BODY
SET_BACKING_FIELD z type=kotlin.Unit operator=null
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
receiver: THIS enum entry TEST2 type=TestEnum4.TEST2
value: CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
$this: THIS enum entry TEST2 type=TestEnum4.TEST2
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
+2 -1
View File
@@ -12,7 +12,8 @@ FILE /initBlock.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Test2 type=Test2
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
+4 -2
View File
@@ -4,7 +4,8 @@ FILE /initVal.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class TestInitValFromParameter type=TestInitValFromParameter
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitValFromParameter
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
@@ -26,4 +27,5 @@ FILE /initVal.kt
ANONYMOUS_INITIALIZER TestInitValInInitBlock
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
receiver: THIS public final class TestInitValInInitBlock type=TestInitValInInitBlock
value: CONST Int type=kotlin.Int value='0'
+5 -4
View File
@@ -4,7 +4,8 @@ FILE /initVar.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class TestInitVarFromParameter type=TestInitVarFromParameter
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestInitVarFromParameter
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
@@ -39,13 +40,13 @@ FILE /initVar.kt
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
value: GET_VAR value type=kotlin.Int operator=null
CLASS CLASS TestInitVarWithCustomSetterWithExplicitCtor
PROPERTY public final var x: kotlin.Int
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
value: GET_VAR value type=kotlin.Int operator=null
ANONYMOUS_INITIALIZER TestInitVarWithCustomSetterWithExplicitCtor
BLOCK_BODY
CALL .<set-x> type=kotlin.Unit operator=EQ
@@ -60,7 +61,7 @@ FILE /initVar.kt
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
value: GET_VAR value type=kotlin.Int operator=null
CONSTRUCTOR public constructor TestInitVarWithCustomSetterInCtor()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
@@ -16,5 +16,6 @@ FILE /objectWithInitializers.kt
ANONYMOUS_INITIALIZER Test
BLOCK_BODY
SET_BACKING_FIELD y type=kotlin.Unit operator=null
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
receiver: THIS public object Test : Base type=Test
value: CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
$this: THIS public object Test : Base type=Test
+10 -5
View File
@@ -4,9 +4,11 @@ FILE /primaryConstructor.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Test1 type=Test1
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Test1 type=Test1
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test1
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
@@ -19,7 +21,8 @@ FILE /primaryConstructor.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Test2 type=Test2
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test2
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
@@ -32,7 +35,8 @@ FILE /primaryConstructor.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Test3 type=Test3
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Test3
PROPERTY public final val y: kotlin.Int
EXPRESSION_BODY
@@ -41,4 +45,5 @@ FILE /primaryConstructor.kt
ANONYMOUS_INITIALIZER Test3
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=null
receiver: THIS public final class Test3 type=Test3
value: GET_VAR x type=kotlin.Int operator=null
@@ -19,9 +19,11 @@ FILE /primaryConstructorWithSuperConstructorCall.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class TestWithDelegatingConstructor : Base type=TestWithDelegatingConstructor
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD y type=kotlin.Unit operator=null
GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class TestWithDelegatingConstructor : Base type=TestWithDelegatingConstructor
value: GET_VAR y type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=TestWithDelegatingConstructor
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
+6 -3
View File
@@ -9,7 +9,8 @@ FILE /sealedClasses.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Expr
SET_BACKING_FIELD number type=kotlin.Unit operator=null
GET_VAR number type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Const : Expr type=Expr.Const
value: GET_VAR number type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Const
PROPERTY public final val number: kotlin.Double
EXPRESSION_BODY
@@ -19,9 +20,11 @@ FILE /sealedClasses.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Expr
SET_BACKING_FIELD e1 type=kotlin.Unit operator=null
GET_VAR e1 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Sum : Expr type=Expr.Sum
value: GET_VAR e1 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
SET_BACKING_FIELD e2 type=kotlin.Unit operator=null
GET_VAR e2 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Sum : Expr type=Expr.Sum
value: GET_VAR e2 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Sum
PROPERTY public final val e1: Expr
EXPRESSION_BODY
@@ -17,7 +17,8 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt
ANONYMOUS_INITIALIZER TestInitBlock
BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
receiver: THIS public final class TestInitBlock : Base type=TestInitBlock
value: CONST Int type=kotlin.Int value='0'
CONSTRUCTOR public constructor TestInitBlock()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
@@ -21,7 +21,8 @@ FILE /delegatedProperties.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD map type=kotlin.Unit operator=null
GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class C type=C
value: GET_VAR map type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val map: kotlin.collections.MutableMap<kotlin.String, kotlin.Any>
EXPRESSION_BODY
@@ -41,6 +42,7 @@ FILE /delegatedProperties.kt
RETURN type=kotlin.Nothing from=<get-test2>
CALL .getValue type=kotlin.Int operator=null
$receiver: GET_BACKING_FIELD test2$delegate type=kotlin.Lazy<kotlin.Int> operator=null
receiver: THIS public final class C type=C
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE test2 type=kotlin.reflect.KProperty1<C, kotlin.Int> operator=PROPERTY_REFERENCE_FOR_DELEGATE
PROPERTY public final var test3: kotlin.Any
@@ -53,6 +55,7 @@ FILE /delegatedProperties.kt
RETURN type=kotlin.Nothing from=<get-test3>
CALL .getValue type=kotlin.Any operator=null
$receiver: GET_BACKING_FIELD test3$delegate type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=null
receiver: THIS public final class C type=C
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE test3 type=kotlin.reflect.KMutableProperty1<C, kotlin.Any> operator=PROPERTY_REFERENCE_FOR_DELEGATE
PROPERTY_SETTER public final fun <set-test3>(/*0*/ <set-?>: kotlin.Any): kotlin.Unit
@@ -60,6 +63,7 @@ FILE /delegatedProperties.kt
RETURN type=kotlin.Nothing from=<set-test3>
CALL .setValue type=kotlin.Unit operator=null
$receiver: GET_BACKING_FIELD test3$delegate type=kotlin.collections.MutableMap<kotlin.String, kotlin.Any> operator=null
receiver: THIS public final class C type=C
thisRef: THIS public final class C type=C
property: CALLABLE_REFERENCE test3 type=kotlin.reflect.KMutableProperty1<C, kotlin.Any> operator=PROPERTY_REFERENCE_FOR_DELEGATE
value: GET_VAR <set-?> type=kotlin.Any operator=null
@@ -16,7 +16,8 @@ FILE /arrayAugmentedAssignment1.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class C type=C
value: GET_VAR x type=kotlin.IntArray operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=C
PROPERTY public final val x: kotlin.IntArray
EXPRESSION_BODY
+2 -1
View File
@@ -4,7 +4,8 @@ FILE /assignments.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD x type=kotlin.Unit operator=null
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Ref type=Ref
value: GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
PROPERTY public final var x: kotlin.Int
EXPRESSION_BODY
@@ -93,7 +93,8 @@ FILE /complexAugmentedAssignment.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD s type=kotlin.Unit operator=null
GET_VAR s type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class B type=B
value: GET_VAR s type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=B
PROPERTY public final var s: kotlin.Int
EXPRESSION_BODY
+1 -1
View File
@@ -5,6 +5,6 @@ object B {
operator fun A.component2() = 2
}
fun B.test() { // <<< destructuring1.txt
fun B.test() {
val (x, y) = A
}
+32 -13
View File
@@ -1,13 +1,32 @@
FUN public fun B.test(): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit operator=DESTRUCTURING_DECLARATION
VAR val tmp0_container: A
GET_OBJECT A type=A
VAR val x: kotlin.Int
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
$this: $RECEIVER of: test type=B
$receiver: GET_VAR tmp0_container type=A operator=null
VAR val y: kotlin.Int
CALL .component2 type=kotlin.Int operator=COMPONENT_N(index=2)
$this: $RECEIVER of: test type=B
$receiver: GET_VAR tmp0_container type=A operator=null
FILE /destructuring1.kt
CLASS OBJECT A
CONSTRUCTOR private constructor A()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=A
CLASS OBJECT B
CONSTRUCTOR private constructor B()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
INSTANCE_INITIALIZER_CALL classDescriptor=B
FUN public final operator fun A.component1(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=component1
CONST Int type=kotlin.Int value='1'
FUN public final operator fun A.component2(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=component2
CONST Int type=kotlin.Int value='2'
FUN public fun B.test(): kotlin.Unit
BLOCK_BODY
BLOCK type=kotlin.Unit operator=DESTRUCTURING_DECLARATION
VAR val tmp0_container: A
GET_OBJECT A type=A
VAR val x: kotlin.Int
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
$this: $RECEIVER of: test type=B
$receiver: GET_VAR tmp0_container type=A operator=null
VAR val y: kotlin.Int
CALL .component2 type=kotlin.Int operator=COMPONENT_N(index=2)
$this: $RECEIVER of: test type=B
$receiver: GET_VAR tmp0_container type=A operator=null
+2 -2
View File
@@ -5,13 +5,13 @@ FILE /field.kt
PROPERTY_SETTER public fun <set-testSimple>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD testSimple type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
value: GET_VAR value type=kotlin.Int operator=null
PROPERTY public var testAugmented: kotlin.Int
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
PROPERTY_SETTER public fun <set-testAugmented>(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD testAugmented type=kotlin.Unit operator=PLUSEQ
CALL .plus type=kotlin.Int operator=PLUSEQ
value: CALL .plus type=kotlin.Int operator=PLUSEQ
$this: GET_BACKING_FIELD testAugmented type=kotlin.Int operator=PLUSEQ
other: GET_VAR value type=kotlin.Int operator=null
@@ -9,7 +9,8 @@ FILE /forWithImplicitReceivers.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class IntCell type=IntCell
value: GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=IntCell
PROPERTY public final var value: kotlin.Int
EXPRESSION_BODY
@@ -0,0 +1,19 @@
// FILE: Derived.kt
// IR_FILE: jvmInstanceFieldReference.txt
class Derived: Base() {
init {
value = 0
}
fun getValue() = value
fun setValue(value: Int) {
this.value = value
}
}
// FILE: Base.java
public class Base {
public int value;
}
@@ -0,0 +1,21 @@
FILE /Derived.kt
CLASS CLASS Derived
CONSTRUCTOR public constructor Derived()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=Derived
ANONYMOUS_INITIALIZER Derived
BLOCK_BODY
SET_BACKING_FIELD value type=kotlin.Unit operator=EQ
receiver: THIS public final class Derived : Base type=Derived
value: CONST Int type=kotlin.Int value='0'
FUN public final fun getValue(): kotlin.Int
BLOCK_BODY
RETURN type=kotlin.Nothing from=getValue
GET_BACKING_FIELD value type=kotlin.Int operator=GET_PROPERTY
receiver: THIS public final class Derived : Base type=Derived
FUN public final fun setValue(/*0*/ value: kotlin.Int): kotlin.Unit
BLOCK_BODY
SET_BACKING_FIELD value type=kotlin.Unit operator=EQ
receiver: THIS public final class Derived : Base type=Derived
value: GET_VAR value type=kotlin.Int operator=null
@@ -3,14 +3,14 @@ FILE /jvmStaticFieldReference.kt
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
GET_BACKING_FIELD out type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='testFun'
PROPERTY public var testProp: kotlin.Any
PROPERTY_GETTER public fun <get-testProp>(): kotlin.Any
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
GET_BACKING_FIELD out type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='testProp/get'
RETURN type=kotlin.Nothing from=<get-testProp>
CONST Int type=kotlin.Int value='42'
@@ -18,7 +18,7 @@ FILE /jvmStaticFieldReference.kt
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
GET_BACKING_FIELD out type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='testProp/set'
CLASS CLASS TestClass
CONSTRUCTOR public constructor TestClass()
@@ -31,12 +31,12 @@ FILE /jvmStaticFieldReference.kt
else: BLOCK type=kotlin.Int operator=null
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
GET_BACKING_FIELD out type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/test'
CONST Int type=kotlin.Int value='42'
ANONYMOUS_INITIALIZER TestClass
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
$this: TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=java.io.PrintStream
CALL .<get-out> type=java.io.PrintStream! operator=GET_PROPERTY
GET_BACKING_FIELD out type=java.io.PrintStream! operator=GET_PROPERTY
p0: CONST String type=kotlin.String value='TestClass/init'
+2 -1
View File
@@ -4,7 +4,8 @@ FILE /safeCalls.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Any
SET_BACKING_FIELD value type=kotlin.Unit operator=null
GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
receiver: THIS public final class Ref type=Ref
value: GET_VAR value type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
INSTANCE_INITIALIZER_CALL classDescriptor=Ref
PROPERTY public final var value: kotlin.Int
EXPRESSION_BODY
@@ -0,0 +1,14 @@
// FILE: Derived.kt
// IR_FILE: setFieldWithImplicitCast.txt
class Derived : Base() {
fun setValue(v: Any) {
if (v is String) {
value = v
}
}
}
// FILE: Base.java
public class Base {
public String value;
}
@@ -0,0 +1,16 @@
FILE /Derived.kt
CLASS CLASS Derived
CONSTRUCTOR public constructor Derived()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL Base
INSTANCE_INITIALIZER_CALL classDescriptor=Derived
FUN public final fun setValue(/*0*/ v: kotlin.Any): kotlin.Unit
BLOCK_BODY
WHEN type=kotlin.Unit operator=IF
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
GET_VAR v type=kotlin.Any operator=null
then: BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD value type=kotlin.Unit operator=EQ
receiver: THIS public final class Derived : Base type=Derived
value: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String!
GET_VAR v type=kotlin.Any operator=null