K2: Remove redundant parameters in ClassWrapper

This commit is contained in:
Denis.Zharkov
2023-06-26 15:05:48 +03:00
committed by Space Team
parent 03e06be324
commit 987fa87c90
2 changed files with 7 additions and 11 deletions
@@ -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 {
@@ -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,