Underlying classes for enum entries.

This commit is contained in:
Dmitry Petrov
2016-08-31 15:46:47 +03:00
committed by Dmitry Petrov
parent bd76e39a8c
commit 9eeb492fe3
7 changed files with 133 additions and 24 deletions
+29
View File
@@ -6,4 +6,33 @@ enum class TestEnum2(val x: Int) {
TEST1(1),
TEST2(2),
TEST3(3)
}
enum class TestEnum3 {
TEST {
override fun foo() {
println("Hello, world!")
}
}
;
abstract fun foo()
}
enum class TestEnum4(val x: Int) {
TEST1(1) {
override fun foo() {
println(TEST1)
}
},
TEST2(2) {
val z: Int
init {
z = x
}
override fun foo() {
println(TEST2)
}
}
;
abstract fun foo()
}
+52
View File
@@ -25,3 +25,55 @@ FILE /enum.kt
ENUM_ENTRY enum entry TEST3
init: ENUM_CONSTRUCTOR_CALL TestEnum2 TEST3
x: CONST Int type=kotlin.Int value='3'
CLASS ENUM_CLASS TestEnum3
FUN private constructor TestEnum3()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL Enum super
ENUM_ENTRY enum entry TEST
init: ENUM_CONSTRUCTOR_CALL TEST TEST
class: CLASS ENUM_ENTRY TEST
FUN private constructor TEST()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum3 super
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: CONST String type=kotlin.String value='Hello, world!'
FUN public abstract fun foo(): kotlin.Unit
CLASS ENUM_CLASS TestEnum4
FUN private constructor TestEnum4(/*0*/ x: kotlin.Int)
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
PROPERTY public final val x: kotlin.Int
EXPRESSION_BODY
GET_VAR x type=kotlin.Int operator=INITIALIZE_PROPERTY_FROM_PARAMETER
ENUM_ENTRY enum entry TEST1
init: ENUM_CONSTRUCTOR_CALL TEST1 TEST1
class: CLASS ENUM_ENTRY TEST1
FUN private constructor TEST1()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum4 super
x: CONST Int type=kotlin.Int value='1'
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: GET_ENUM_VALUE TEST1 type=TestEnum4
ENUM_ENTRY enum entry TEST2
init: ENUM_CONSTRUCTOR_CALL TEST2 TEST2
class: CLASS ENUM_ENTRY TEST2
FUN private constructor TEST2()
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL TestEnum4 super
x: CONST Int type=kotlin.Int value='2'
BLOCK type=kotlin.Unit operator=null
SET_BACKING_FIELD z type=kotlin.Unit operator=null
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
$this: THIS enum entry TEST2 type=TestEnum4.TEST2
PROPERTY public final val z: kotlin.Int
FUN public open override /*1*/ fun foo(): kotlin.Unit
BLOCK_BODY
CALL .println type=kotlin.Unit operator=null
message: GET_ENUM_VALUE TEST2 type=TestEnum4
FUN public abstract fun foo(): kotlin.Unit