FirEnumEntry: set correct child class name
This commit is contained in:
+3
-1
@@ -539,7 +539,8 @@ class DeclarationsConverter(
|
||||
session,
|
||||
classWrapper.delegatedSelfTypeRef,
|
||||
name = enumEntryName,
|
||||
initializer = FirAnonymousObjectImpl(
|
||||
initializer = withChildClassName(enumEntryName) {
|
||||
FirAnonymousObjectImpl(
|
||||
null,
|
||||
session,
|
||||
ClassKind.ENUM_ENTRY,
|
||||
@@ -564,6 +565,7 @@ class DeclarationsConverter(
|
||||
superTypeRefs += enumClassWrapper.delegatedSuperTypeRef
|
||||
convertPrimaryConstructor(null, enumClassWrapper)?.let { declarations += it.firConstructor }
|
||||
classBodyNode?.also { declarations += convertClassBody(it, enumClassWrapper) }
|
||||
}
|
||||
},
|
||||
symbol = FirVariableSymbol(CallableId(context.currentClassId, enumEntryName)),
|
||||
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
|
||||
|
||||
@@ -479,6 +479,12 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
}
|
||||
|
||||
private fun KtEnumEntry.toFirEnumEntry(delegatedEnumSelfTypeRef: FirResolvedTypeRef): FirDeclaration {
|
||||
return FirEnumEntryImpl(
|
||||
source = toFirSourceElement(),
|
||||
session,
|
||||
delegatedEnumSelfTypeRef,
|
||||
name = nameAsSafeName,
|
||||
initializer = withChildClassName(nameAsSafeName) {
|
||||
val obj = FirAnonymousObjectImpl(
|
||||
source = toFirSourceElement(),
|
||||
session,
|
||||
@@ -514,13 +520,8 @@ class RawFirBuilder(session: FirSession, val scopeProvider: FirScopeProvider, va
|
||||
hasPrimaryConstructor = true
|
||||
)
|
||||
}
|
||||
|
||||
return FirEnumEntryImpl(
|
||||
source = toFirSourceElement(),
|
||||
session,
|
||||
delegatedEnumSelfTypeRef,
|
||||
name = nameAsSafeName,
|
||||
initializer = obj,
|
||||
obj
|
||||
},
|
||||
status = FirDeclarationStatusImpl(
|
||||
Visibilities.PUBLIC, Modality.FINAL
|
||||
).apply {
|
||||
|
||||
+13
-25
@@ -5,12 +5,13 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]'
|
||||
CLASS ENUM_ENTRY name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
ENUM_ENTRY name:Z
|
||||
class: CLASS ENUM_ENTRY name:Z modality:FINAL visibility:local superTypes:[<root>.MyEnum]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.Z
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.MyEnum.Z [primary]
|
||||
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
DELEGATING_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Z modality:FINAL visibility:local superTypes:[<root>.MyEnum]'
|
||||
PROPERTY name:counter visibility:public modality:FINAL [var]
|
||||
FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private
|
||||
EXPRESSION_BODY
|
||||
@@ -37,10 +38,10 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum.Z
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
receiver: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
value: CONST Int type=kotlin.Int value=1
|
||||
CALL 'public final fun foo (): kotlin.Unit declared in <root>.MyEnum.Z' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
PROPERTY name:aLambda visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:aLambda type:kotlin.Function0<kotlin.Unit> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
@@ -49,10 +50,10 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum.Z
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
receiver: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
value: CONST Int type=kotlin.Int value=1
|
||||
CALL 'public final fun foo (): kotlin.Unit declared in <root>.MyEnum.Z' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-aLambda> visibility:public modality:FINAL <> ($this:<root>.MyEnum.Z) returnType:kotlin.Function0<kotlin.Unit>
|
||||
correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum.Z
|
||||
@@ -73,18 +74,18 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
|
||||
ANONYMOUS_INITIALIZER isStatic=false
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
receiver: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
value: CONST Int type=kotlin.Int value=1
|
||||
CALL 'public final fun foo (): kotlin.Unit declared in <root>.MyEnum.Z' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> ($this:<root>.MyEnum.Z.anObject.<no name provided>) returnType:kotlin.Unit
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum.Z.anObject.<no name provided>
|
||||
BLOCK_BODY
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
receiver: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
value: CONST Int type=kotlin.Int value=1
|
||||
CALL 'public final fun foo (): kotlin.Unit declared in <root>.MyEnum.Z' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
|
||||
$this: GET_VAR '<this>: <uninitialized parent>.<anonymous> declared in <no parent>.<anonymous>' type=<uninitialized parent>.<anonymous> origin=null
|
||||
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum.Z.anObject.<no name provided>' type=<root>.MyEnum.Z.anObject.<no name provided> origin=null
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-anObject> visibility:public modality:FINAL <> ($this:<root>.MyEnum.Z) returnType:<uninitialized parent>.<anonymous>
|
||||
correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL [val]
|
||||
@@ -93,19 +94,6 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-anObject> (): <uninitialized parent>.<anonymous> declared in <root>.MyEnum.Z'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:anObject type:<uninitialized parent>.<anonymous> visibility:private [final]' type=<uninitialized parent>.<anonymous> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z.<get-anObject>' type=<root>.MyEnum.Z origin=null
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
|
||||
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
|
||||
overridden:
|
||||
public open fun hashCode (): kotlin.Int declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
|
||||
overridden:
|
||||
public open fun toString (): kotlin.String declared in kotlin.Any
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:values visibility:public modality:FINAL <> ($this:<root>.MyEnum) returnType:kotlin.Array<<root>.MyEnum>
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum
|
||||
BLOCK_BODY
|
||||
|
||||
Reference in New Issue
Block a user