Generate nested initializers for class.

This commit is contained in:
Dmitry Petrov
2016-08-29 17:59:44 +03:00
committed by Dmitry Petrov
parent 415265276a
commit ba85e714e3
13 changed files with 85 additions and 33 deletions
@@ -3,12 +3,15 @@ FILE /delegatingConstructorCallsInSecondaryConstructors.kt
FUN public constructor Base()
BLOCK_BODY
CLASS CLASS Test
nestedInitializers: BLOCK_BODY
FUN public constructor Test()
BLOCK_BODY
CALL .<init> type=Base operator=DELEGATING_CONSTRUCTOR_CALL
NESTED_INITIALIZERS_CALL classDescriptor=Test
FUN public constructor Test(/*0*/ xx: kotlin.Int)
BLOCK_BODY
CALL .<init> type=Base operator=DELEGATING_CONSTRUCTOR_CALL
NESTED_INITIALIZERS_CALL classDescriptor=Test
FUN public constructor Test(/*0*/ xx: kotlin.Short)
BLOCK_BODY
CALL .<init> type=Test operator=DELEGATING_CONSTRUCTOR_CALL
+8 -4
View File
@@ -36,6 +36,11 @@ FILE /initVar.kt
SET_BACKING_FIELD x type=kotlin.Unit operator=EQ
GET_VAR value type=kotlin.Int operator=null
CLASS CLASS TestInitVarWithCustomSetterWithExplicitCtor
nestedInitializers: BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterWithExplicitCtor type=TestInitVarWithCustomSetterWithExplicitCtor
value: CONST Int type=kotlin.Int value='0'
PROPERTY public final var x: kotlin.Int getter=null setter=<set-x>
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit property=x
BLOCK_BODY
@@ -44,11 +49,9 @@ FILE /initVar.kt
FUN public constructor TestInitVarWithCustomSetterWithExplicitCtor()
BLOCK_BODY
CALL .<init> type=kotlin.Any operator=DELEGATING_CONSTRUCTOR_CALL
BLOCK type=kotlin.Unit operator=null
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterWithExplicitCtor type=TestInitVarWithCustomSetterWithExplicitCtor
value: CONST Int type=kotlin.Int value='0'
NESTED_INITIALIZERS_CALL classDescriptor=TestInitVarWithCustomSetterWithExplicitCtor
CLASS CLASS TestInitVarWithCustomSetterInCtor
nestedInitializers: BLOCK_BODY
PROPERTY public final var x: kotlin.Int getter=null setter=<set-x>
PROPERTY_SETTER public final fun <set-x>(/*0*/ value: kotlin.Int): kotlin.Unit property=x
BLOCK_BODY
@@ -57,6 +60,7 @@ FILE /initVar.kt
FUN public constructor TestInitVarWithCustomSetterInCtor()
BLOCK_BODY
CALL .<init> type=kotlin.Any operator=DELEGATING_CONSTRUCTOR_CALL
NESTED_INITIALIZERS_CALL classDescriptor=TestInitVarWithCustomSetterInCtor
CALL .<set-x> type=kotlin.Unit operator=EQ
$this: THIS public final class TestInitVarWithCustomSetterInCtor type=TestInitVarWithCustomSetterInCtor
value: CONST Int type=kotlin.Int value='42'
@@ -3,19 +3,23 @@ FILE /secondaryConstructorWithInitializersFromClassBody.kt
FUN public constructor Base()
BLOCK_BODY
CLASS CLASS TestProperty
nestedInitializers: BLOCK_BODY
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
PROPERTY public final val x: kotlin.Int = 0 getter=null setter=null
EXPRESSION_BODY
CONST Int type=kotlin.Int value='0'
FUN public constructor TestProperty()
BLOCK_BODY
CALL .<init> type=Base operator=DELEGATING_CONSTRUCTOR_CALL
NESTED_INITIALIZERS_CALL classDescriptor=TestProperty
CLASS CLASS TestInitBlock
nestedInitializers: BLOCK_BODY
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
CLASS CLASS TestInitBlock
PROPERTY public final val x: kotlin.Int getter=null setter=null
FUN public constructor TestInitBlock()
BLOCK_BODY
CALL .<init> type=Base operator=DELEGATING_CONSTRUCTOR_CALL
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD x type=kotlin.Unit operator=null
CONST Int type=kotlin.Int value='0'
NESTED_INITIALIZERS_CALL classDescriptor=TestInitBlock
@@ -1,5 +1,6 @@
FILE /secondaryConstructors.kt
CLASS CLASS C
nestedInitializers: BLOCK_BODY
FUN public constructor C()
BLOCK_BODY
CALL .<init> type=C operator=DELEGATING_CONSTRUCTOR_CALL
@@ -7,3 +8,4 @@ FILE /secondaryConstructors.kt
FUN public constructor C(/*0*/ x: kotlin.Int)
BLOCK_BODY
CALL .<init> type=kotlin.Any operator=DELEGATING_CONSTRUCTOR_CALL
NESTED_INITIALIZERS_CALL classDescriptor=C