From 987fa87c90858e3925307ecdb9737648486df5e8 Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 26 Jun 2023 15:05:48 +0300 Subject: [PATCH] K2: Remove redundant parameters in ClassWrapper --- .../converter/LightTreeRawFirDeclarationBuilder.kt | 14 +++++++------- .../kotlin/fir/lightTree/fir/ClassWrapper.kt | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt index 1506f544f32..f89e11ddee4 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/LightTreeRawFirDeclarationBuilder.kt @@ -541,9 +541,7 @@ class LightTreeRawFirDeclarationBuilder( val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR) val classWrapper = ClassWrapper( - className, modifiers, classKind, this, - hasPrimaryConstructor = primaryConstructor != null, - hasSecondaryConstructor = secondaryConstructors.isNotEmpty(), + modifiers, classKind, this, hasSecondaryConstructor = secondaryConstructors.isNotEmpty(), hasDefaultConstructor = if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters() else secondaryConstructors.isEmpty() || secondaryConstructors.any { !it.hasValueParameters() }, delegatedSelfTypeRef = selfType, @@ -699,8 +697,9 @@ class LightTreeRawFirDeclarationBuilder( this.superTypeRefs += superTypeRefs val classWrapper = ClassWrapper( - SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, this, - hasPrimaryConstructor = false, + modifiers, + ClassKind.OBJECT, + this, hasSecondaryConstructor = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), hasDefaultConstructor = false, delegatedSelfTypeRef = delegatedSelfType, @@ -784,8 +783,9 @@ class LightTreeRawFirDeclarationBuilder( symbol = FirAnonymousObjectSymbol() status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) val enumClassWrapper = ClassWrapper( - enumEntryName, modifiers, ClassKind.ENUM_ENTRY, this, - hasPrimaryConstructor = true, + modifiers, + ClassKind.ENUM_ENTRY, + this, hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), hasDefaultConstructor = false, delegatedSelfTypeRef = buildResolvedTypeRef { diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ClassWrapper.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ClassWrapper.kt index b0c5c8da812..6a5de1b2d38 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ClassWrapper.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/ClassWrapper.kt @@ -14,15 +14,11 @@ import org.jetbrains.kotlin.fir.declarations.builder.FirClassBuilder import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier import org.jetbrains.kotlin.fir.types.FirTypeRef -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.name.SpecialNames class ClassWrapper( - private val className: Name, private val modifiers: Modifier, private val classKind: ClassKind, val classBuilder: FirClassBuilder, - val hasPrimaryConstructor: Boolean, val hasSecondaryConstructor: Boolean, val hasDefaultConstructor: Boolean, val delegatedSelfTypeRef: FirTypeRef,