IR API: Make IrEnumEntry.initializerExpression IrExpressionBody

All non-declarations should be inside IrBody's now
This commit is contained in:
Anton Bannykh
2020-01-22 13:02:40 +03:00
parent 3ec671d727
commit 0bcde9dffc
22 changed files with 125 additions and 82 deletions

View File

@@ -587,7 +587,7 @@ class Fir2IrDeclarationStorage(
this.correspondingClass = klass
} else if (irParent != null) {
this.initializerExpression =
IrEnumConstructorCallImpl(startOffset, endOffset, irType, irParent.constructors.first().symbol)
IrExpressionBodyImpl(IrEnumConstructorCallImpl(startOffset, endOffset, irType, irParent.constructors.first().symbol))
}
}
}

View File

@@ -443,7 +443,7 @@ class EnumClassTransformer(val context: JsIrBackendContext, private val irClass:
+irIfThen(irGetField(null, entryInstancesInitializedField), irReturnUnit())
+irSetField(null, entryInstancesInitializedField, irBoolean(true))
for ((entry, instanceField) in enumEntries.zip(entryInstances)) {
+irSetField(null, instanceField, entry.initializerExpression!!)
+irSetField(null, instanceField, entry.initializerExpression!!.expression)
}
}.also {
// entry.initializerExpression can have local declarations

View File

@@ -81,7 +81,7 @@ private class EnumClassLowering(val context: JvmBackendContext) : ClassLoweringP
private fun buildEnumEntryField(enumEntry: IrEnumEntry): IrField =
context.declarationFactory.getFieldForEnumEntry(enumEntry).apply {
initializer = IrExpressionBodyImpl(enumEntry.initializerExpression!!.patchDeclarationParents(this))
initializer = IrExpressionBodyImpl(enumEntry.initializerExpression!!.expression.patchDeclarationParents(this))
annotations += enumEntry.annotations
}

View File

@@ -462,8 +462,8 @@ class ClassGenerator(
if (!enumEntryDescriptor.isExpect) {
irEnumEntry.initializerExpression =
createBodyGenerator(irEnumEntry.symbol)
.generateEnumEntryInitializer(ktEnumEntry, enumEntryDescriptor)
IrExpressionBodyImpl(createBodyGenerator(irEnumEntry.symbol)
.generateEnumEntryInitializer(ktEnumEntry, enumEntryDescriptor))
}
if (ktEnumEntry.hasMemberDeclarations()) {

View File

@@ -17,13 +17,13 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol>, IrDeclarationWithName {
override val descriptor: ClassDescriptor
var correspondingClass: IrClass?
var initializerExpression: IrExpression?
var initializerExpression: IrExpressionBody?
}

View File

@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -49,7 +50,7 @@ class IrEnumEntryImpl(
override val descriptor: ClassDescriptor get() = symbol.descriptor
override var correspondingClass: IrClass? = null
override var initializerExpression: IrExpression? = null
override var initializerExpression: IrExpressionBody? = null
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitEnumEntry(this, data)

View File

@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
import org.jetbrains.kotlin.ir.util.DeclarationStubGenerator
import org.jetbrains.kotlin.ir.util.TypeTranslator
@@ -47,7 +47,7 @@ class IrLazyEnumEntryImpl(
override var correspondingClass: IrClass? = null
override var initializerExpression: IrExpression? = null
override var initializerExpression: IrExpressionBody? = null
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitEnumEntry(this, data)

View File

@@ -1097,7 +1097,7 @@ abstract class IrFileDeserializer(
if (proto.hasCorrespondingClass())
correspondingClass = deserializeIrClass(proto.correspondingClass)
if (proto.hasInitializer())
initializerExpression = deserializeExpressionBody(proto.initializer)
initializerExpression = IrExpressionBodyImpl(deserializeExpressionBody(proto.initializer))
(descriptor as? WrappedEnumEntryDescriptor)?.bind(this)
}

View File

@@ -1231,7 +1231,7 @@ open class IrFileSerializer(
.setName(serializeName(enumEntry.name))
enumEntry.initializerExpression?.let {
proto.initializer = serializeIrExpressionBody(it)
proto.initializer = serializeIrExpressionBody(it.expression)
}
enumEntry.correspondingClass?.let {
proto.correspondingClass = serializeIrClass(it)

View File

@@ -7,9 +7,11 @@ FILE fqName:<root> fileName:/enum.kt
<E>: <root>.TestEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestEnum1>]'
ENUM_ENTRY name:TEST1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
ENUM_ENTRY name:TEST2
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestEnum1>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum
@@ -77,14 +79,17 @@ FILE fqName:<root> fileName:/enum.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.TestEnum2 declared in <root>.TestEnum2.<get-x>' type=<root>.TestEnum2 origin=null
ENUM_ENTRY name:TEST1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=1
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=1
ENUM_ENTRY name:TEST2
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=2
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=2
ENUM_ENTRY name:TEST3
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=3
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum2'
x: CONST Int type=kotlin.Int value=3
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestEnum2>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum
@@ -140,7 +145,8 @@ FILE fqName:<root> fileName:/enum.kt
<E>: <root>.TestEnum3
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum3 modality:ABSTRACT visibility:public superTypes:[kotlin.Enum<<root>.TestEnum3>]'
ENUM_ENTRY name:TEST
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum3.TEST'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum3.TEST'
class: CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:public superTypes:[<root>.TestEnum3]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum3.TEST
CONSTRUCTOR visibility:private <> () returnType:<root>.TestEnum3.TEST [primary]
@@ -266,7 +272,8 @@ FILE fqName:<root> fileName:/enum.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.TestEnum4 declared in <root>.TestEnum4.<get-x>' type=<root>.TestEnum4 origin=null
ENUM_ENTRY name:TEST1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum4.TEST1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum4.TEST1'
class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:public superTypes:[<root>.TestEnum4]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum4.TEST1
CONSTRUCTOR visibility:private <> () returnType:<root>.TestEnum4.TEST1 [primary]
@@ -331,7 +338,8 @@ FILE fqName:<root> fileName:/enum.kt
public open fun toString (): kotlin.String [fake_override] declared in <root>.TestEnum4
$this: VALUE_PARAMETER name:<this> type:kotlin.Enum<<root>.TestEnum4>
ENUM_ENTRY name:TEST2
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum4.TEST2'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum4.TEST2'
class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:public superTypes:[<root>.TestEnum4]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum4.TEST2
CONSTRUCTOR visibility:private <> () returnType:<root>.TestEnum4.TEST2 [primary]
@@ -481,12 +489,15 @@ FILE fqName:<root> fileName:/enum.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.TestEnum5 declared in <root>.TestEnum5.<get-x>' type=<root>.TestEnum5 origin=null
ENUM_ENTRY name:TEST1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
ENUM_ENTRY name:TEST2
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
ENUM_ENTRY name:TEST3
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
x: CONST Int type=kotlin.Int value=0
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestEnum5'
x: CONST Int type=kotlin.Int value=0
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestEnum5>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum
@@ -570,14 +581,15 @@ FILE fqName:<root> fileName:/enum.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.TestEnum6 declared in <root>.TestEnum6.<get-y>' type=<root>.TestEnum6 origin=null
ENUM_ENTRY name:TEST
init: BLOCK type=<root>.TestEnum6 origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
CALL 'public final fun f (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'public final fun f (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.TestEnum6'
x: GET_VAR 'val tmp_1: kotlin.Int [val] declared in <root>.TestEnum6' type=kotlin.Int origin=null
y: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.TestEnum6' type=kotlin.Int origin=null
init: EXPRESSION_BODY
BLOCK type=<root>.TestEnum6 origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val]
CALL 'public final fun f (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_1 type:kotlin.Int [val]
CALL 'public final fun f (): kotlin.Int declared in <root>' type=kotlin.Int origin=null
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.TestEnum6'
x: GET_VAR 'val tmp_1: kotlin.Int [val] declared in <root>.TestEnum6' type=kotlin.Int origin=null
y: GET_VAR 'val tmp_0: kotlin.Int [val] declared in <root>.TestEnum6' type=kotlin.Int origin=null
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestEnum6>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum1>]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum1'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestFinalEnum1>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum
@@ -75,8 +76,9 @@ FILE fqName:<root> fileName:/enumClassModality.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.TestFinalEnum2 declared in <root>.TestFinalEnum2.<get-x>' type=<root>.TestFinalEnum2 origin=null
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestFinalEnum2'
x: CONST Int type=kotlin.Int value=1
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.TestFinalEnum2'
x: CONST Int type=kotlin.Int value=1
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.TestFinalEnum2>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum
@@ -132,7 +134,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum3
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum3 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum3>]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum3'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum3'
FUN name:doStuff visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum3) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum3
BLOCK_BODY
@@ -191,7 +194,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestOpenEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestOpenEnum1 modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.TestOpenEnum1>]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestOpenEnum1.X1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestOpenEnum1.X1'
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:public superTypes:[<root>.TestOpenEnum1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestOpenEnum1.X1
CONSTRUCTOR visibility:private <> () returnType:<root>.TestOpenEnum1.X1 [primary]
@@ -299,7 +303,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestOpenEnum2
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestOpenEnum2 modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.TestOpenEnum2>]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestOpenEnum2.X1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestOpenEnum2.X1'
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:public superTypes:[<root>.TestOpenEnum2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestOpenEnum2.X1
CONSTRUCTOR visibility:private <> () returnType:<root>.TestOpenEnum2.X1 [primary]
@@ -412,7 +417,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestAbstractEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestAbstractEnum1 modality:ABSTRACT visibility:public superTypes:[kotlin.Enum<<root>.TestAbstractEnum1>]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestAbstractEnum1.X1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestAbstractEnum1.X1'
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:public superTypes:[<root>.TestAbstractEnum1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestAbstractEnum1.X1
CONSTRUCTOR visibility:private <> () returnType:<root>.TestAbstractEnum1.X1 [primary]
@@ -541,7 +547,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestAbstractEnum2
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestAbstractEnum2 modality:ABSTRACT visibility:public superTypes:[kotlin.Enum<<root>.TestAbstractEnum2>; <root>.IFoo]'
ENUM_ENTRY name:X1
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestAbstractEnum2.X1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestAbstractEnum2.X1'
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:public superTypes:[<root>.TestAbstractEnum2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestAbstractEnum2.X1
CONSTRUCTOR visibility:private <> () returnType:<root>.TestAbstractEnum2.X1 [primary]

View File

@@ -2,10 +2,12 @@ FILE fqName:<root> fileName:/enumWithMultipleCtors.kt
CLASS ENUM_CLASS name:A modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.A>]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
ENUM_ENTRY name:X
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (arg: kotlin.String) declared in <root>.A'
arg: CONST String type=kotlin.String value="asd"
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (arg: kotlin.String) declared in <root>.A'
arg: CONST String type=kotlin.String value="asd"
ENUM_ENTRY name:Y
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.A.Y'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.A.Y'
class: CLASS ENUM_ENTRY name:Y modality:FINAL visibility:public superTypes:[<root>.A]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A.Y
CONSTRUCTOR visibility:private <> () returnType:<root>.A.Y [primary]
@@ -90,8 +92,9 @@ FILE fqName:<root> fileName:/enumWithMultipleCtors.kt
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
$this: VALUE_PARAMETER name:<this> type:kotlin.Enum<<root>.A>
ENUM_ENTRY name:Z
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) declared in <root>.A'
x: CONST Int type=kotlin.Int value=5
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) declared in <root>.A'
x: CONST Int type=kotlin.Int value=5
PROPERTY name:prop1 visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:prop1 type:kotlin.String visibility:private [final]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-prop1> visibility:public modality:FINAL <> ($this:<root>.A) returnType:kotlin.String

View File

@@ -19,7 +19,8 @@ FILE fqName:<root> fileName:/enumWithSecondaryCtor.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Test0 declared in <root>.Test0.<get-x>' type=<root>.Test0 origin=null
ENUM_ENTRY name:ZERO
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.Test0'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.Test0'
CONSTRUCTOR visibility:private <> () returnType:<root>.Test0
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.Test0'
@@ -91,10 +92,12 @@ FILE fqName:<root> fileName:/enumWithSecondaryCtor.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Test1 declared in <root>.Test1.<get-x>' type=<root>.Test1 origin=null
ENUM_ENTRY name:ZERO
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.Test1'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.Test1'
ENUM_ENTRY name:ONE
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.Test1'
x: CONST Int type=kotlin.Int value=1
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.Test1'
x: CONST Int type=kotlin.Int value=1
CONSTRUCTOR visibility:private <> () returnType:<root>.Test1
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.Int) [primary] declared in <root>.Test1'
@@ -166,7 +169,8 @@ FILE fqName:<root> fileName:/enumWithSecondaryCtor.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Test2 declared in <root>.Test2.<get-x>' type=<root>.Test2 origin=null
ENUM_ENTRY name:ZERO
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Test2.ZERO'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Test2.ZERO'
class: CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:public superTypes:[<root>.Test2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test2.ZERO
CONSTRUCTOR visibility:private <> () returnType:<root>.Test2.ZERO [primary]
@@ -230,7 +234,8 @@ FILE fqName:<root> fileName:/enumWithSecondaryCtor.kt
public open fun toString (): kotlin.String [fake_override] declared in <root>.Test2
$this: VALUE_PARAMETER name:<this> type:kotlin.Enum<<root>.Test2>
ENUM_ENTRY name:ONE
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Test2.ONE'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Test2.ONE'
class: CLASS ENUM_ENTRY name:ONE modality:FINAL visibility:public superTypes:[<root>.Test2]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test2.ONE
CONSTRUCTOR visibility:private <> () returnType:<root>.Test2.ONE [primary]

View File

@@ -37,11 +37,13 @@ FILE fqName:<root> fileName:/enumEntriesWithAnnotations.kt
ENUM_ENTRY name:ENTRY1
annotations:
TestAnn(x = 'ENTRY1')
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum'
ENUM_ENTRY name:ENTRY2
annotations:
TestAnn(x = 'ENTRY2')
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum.ENTRY2'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum.ENTRY2'
class: CLASS ENUM_ENTRY name:ENTRY2 modality:FINAL visibility:public superTypes:[<root>.TestEnum]
annotations:
TestAnn(x = 'ENTRY2')

View File

@@ -7,13 +7,17 @@ FILE fqName:<root> fileName:/enumsInAnnotationArguments.kt
<E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:A
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:B
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:C
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:D
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.En>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -58,11 +58,14 @@ FILE fqName:<root> fileName:/expectedEnumClass.kt
<E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]'
ENUM_ENTRY name:FOO
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
ENUM_ENTRY name:BAR
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
ENUM_ENTRY name:BAZ
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.MyEnum>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/enumEntryAsReceiver.kt
<E>: <root>.X
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Enum<<root>.X>]'
ENUM_ENTRY name:B
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.X.B'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.X.B'
class: CLASS ENUM_ENTRY name:B modality:FINAL visibility:public superTypes:[<root>.X]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.X.B
CONSTRUCTOR visibility:private <> () returnType:<root>.X.B [primary]

View File

@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
<E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]'
ENUM_ENTRY name:Z
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum.Z'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum.Z'
class: CLASS ENUM_ENTRY name:Z modality:FINAL visibility:public superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.Z
CONSTRUCTOR visibility:private <> () returnType:<root>.MyEnum.Z [primary]

View File

@@ -26,7 +26,8 @@ FILE fqName:<root> fileName:/objectAsCallable.kt
<E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:X
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.En>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -28,20 +28,21 @@ FILE fqName:<root> fileName:/temporaryInEnumEntryInitializer.kt
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.String? visibility:private [final]' type=kotlin.String? origin=null
receiver: GET_VAR '<this>: <root>.En declared in <root>.En.<get-x>' type=<root>.En origin=null
ENUM_ENTRY name:ENTRY
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.String?) [primary] declared in <root>.En'
x: BLOCK type=kotlin.String? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
CALL 'public final fun <get-n> (): kotlin.Any? declared in <root>' type=kotlin.Any? origin=GET_PROPERTY
WHEN type=kotlin.String? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> (x: kotlin.String?) [primary] declared in <root>.En'
x: BLOCK type=kotlin.String? origin=SAFE_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any? [val]
CALL 'public final fun <get-n> (): kotlin.Any? declared in <root>' type=kotlin.Any? origin=GET_PROPERTY
WHEN type=kotlin.String? origin=null
BRANCH
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
arg0: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
then: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null
$this: GET_VAR 'val tmp_0: kotlin.Any? [val] declared in <root>.En' type=kotlin.Any? origin=null
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.En>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/values.kt
<E>: <root>.Enum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Enum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.Enum>]'
ENUM_ENTRY name:A
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Enum'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Enum'
FUN FAKE_OVERRIDE name:clone visibility:protected modality:FINAL <> ($this:kotlin.Enum<<root>.Enum>) returnType:kotlin.Any [fake_override]
overridden:
protected final fun clone (): kotlin.Any declared in kotlin.Enum

View File

@@ -7,7 +7,8 @@ FILE fqName:<root> fileName:/enumEntry.kt
<E>: <root>.Z
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Z modality:OPEN visibility:public superTypes:[kotlin.Enum<<root>.Z>]'
ENUM_ENTRY name:ENTRY
init: ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Z.ENTRY'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Z.ENTRY'
class: CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:public superTypes:[<root>.Z]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z.ENTRY
CONSTRUCTOR visibility:private <> () returnType:<root>.Z.ENTRY [primary]