[FIR] Consider enum entry nested classes as local
This commit is contained in:
+1
@@ -89,6 +89,7 @@ inline fun isClassLocal(classNode: LighterASTNode, getParent: LighterASTNode.()
|
|||||||
parent?.tokenType == KT_FILE -> return true
|
parent?.tokenType == KT_FILE -> return true
|
||||||
parent?.tokenType == CLASS_BODY && !(grandParent?.tokenType == OBJECT_DECLARATION && grandParent?.getParent()?.tokenType == OBJECT_LITERAL) -> return true
|
parent?.tokenType == CLASS_BODY && !(grandParent?.tokenType == OBJECT_DECLARATION && grandParent?.getParent()?.tokenType == OBJECT_LITERAL) -> return true
|
||||||
parent?.tokenType == BLOCK && grandParent?.tokenType == SCRIPT -> return true
|
parent?.tokenType == BLOCK && grandParent?.tokenType == SCRIPT -> return true
|
||||||
|
parent?.tokenType == ENUM_ENTRY -> return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tokenType == BLOCK) {
|
if (tokenType == BLOCK) {
|
||||||
|
|||||||
@@ -648,8 +648,10 @@ class RawFirBuilder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitClassOrObject(classOrObject: KtClassOrObject, data: Unit): FirElement {
|
override fun visitClassOrObject(classOrObject: KtClassOrObject, data: Unit): FirElement {
|
||||||
return withChildClassName(classOrObject.nameAsSafeName, classOrObject.isLocal) {
|
return withChildClassName(
|
||||||
|
classOrObject.nameAsSafeName,
|
||||||
|
classOrObject.isLocal || classOrObject.getStrictParentOfType<KtEnumEntry>() != null
|
||||||
|
) {
|
||||||
val classKind = when (classOrObject) {
|
val classKind = when (classOrObject) {
|
||||||
is KtObjectDeclaration -> ClassKind.OBJECT
|
is KtObjectDeclaration -> ClassKind.OBJECT
|
||||||
is KtClass -> when {
|
is KtClass -> when {
|
||||||
|
|||||||
+1
-1
@@ -288,7 +288,7 @@ class ControlFlowGraphBuilder {
|
|||||||
fun exitLocalClass(klass: FirRegularClass): Pair<LocalClassExitNode, ControlFlowGraph> {
|
fun exitLocalClass(klass: FirRegularClass): Pair<LocalClassExitNode, ControlFlowGraph> {
|
||||||
val graph = exitClass(klass)
|
val graph = exitClass(klass)
|
||||||
val node = createLocalClassExitNode(klass).also {
|
val node = createLocalClassExitNode(klass).also {
|
||||||
addNewSimpleNode(it)
|
addNewSimpleNodeIfPossible(it)
|
||||||
}
|
}
|
||||||
return node to graph
|
return node to graph
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
abstract class Base(val fn: () -> Test)
|
abstract class Base(val fn: () -> Test)
|
||||||
|
|
||||||
enum class Test(val ok: String) {
|
enum class Test(val ok: String) {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
interface IFoo {
|
interface IFoo {
|
||||||
fun foo(): String
|
fun foo(): String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/enumEntry.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
CLASS CLASS name:A modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]
|
CLASS CLASS name:A modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]
|
||||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z.ENTRY.A
|
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z.ENTRY.A
|
||||||
CONSTRUCTOR visibility:public <> ($this:<root>.Z.ENTRY) returnType:IrErrorType [primary]
|
CONSTRUCTOR visibility:public <> ($this:<root>.Z.ENTRY) returnType:<root>.Z.ENTRY.A [primary]
|
||||||
$outer: VALUE_PARAMETER name:<this> type:<root>.Z.ENTRY
|
$outer: VALUE_PARAMETER name:<this> type:<root>.Z.ENTRY
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
|
|||||||
Reference in New Issue
Block a user