From 03e06be3242ad847bb6455edeef63c05c16eb5fa Mon Sep 17 00:00:00 2001 From: "Denis.Zharkov" Date: Mon, 26 Jun 2023 15:04:44 +0300 Subject: [PATCH] K2: Remove redundant TypeModifier class --- .../converter/LightTreeRawFirDeclarationBuilder.kt | 11 +++++------ .../kotlin/fir/lightTree/fir/modifier/TypeModifier.kt | 10 ---------- 2 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/TypeModifier.kt 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 81bb52a0cba..1506f544f32 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 @@ -35,7 +35,6 @@ import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.expressions.impl.FirSingleExpressionBlock import org.jetbrains.kotlin.fir.lightTree.fir.* import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier -import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeModifier import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeParameterModifier import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier import org.jetbrains.kotlin.fir.references.builder.buildExplicitSuperReference @@ -270,8 +269,8 @@ class LightTreeRawFirDeclarationBuilder( /** * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseTypeModifierList */ - private fun convertTypeModifierList(modifiers: LighterASTNode): TypeModifier { - val typeModifier = TypeModifier() + private fun convertTypeModifierList(modifiers: LighterASTNode): Modifier { + val typeModifier = Modifier() modifiers.forEachChildren { when (it.tokenType) { ANNOTATION -> typeModifier.annotations += convertAnnotation(it) @@ -2041,7 +2040,7 @@ class LightTreeRawFirDeclarationBuilder( // 2. `(suspend @A () -> Int)?` is a nullable suspend function type but the modifier list is on the child NULLABLE_TYPE // // TODO: Report MODIFIER_LIST_NOT_ALLOWED error when there are multiple modifier lists. How do we report on each of them? - val allTypeModifiers = mutableListOf() + val allTypeModifiers = mutableListOf() var firType: FirTypeRef? = null type.forEachChildren { @@ -2075,7 +2074,7 @@ class LightTreeRawFirDeclarationBuilder( return calculatedFirType } - private fun Collection.hasSuspend() = any { it.hasSuspend() } + private fun Collection.hasSuspend() = any { it.hasSuspend() } private fun convertIntersectionType(typeRefSource: KtSourceElement, intersectionType: LighterASTNode, isNullable: Boolean): FirTypeRef { val children = arrayListOf() @@ -2120,7 +2119,7 @@ class LightTreeRawFirDeclarationBuilder( private fun convertNullableType( typeRefSource: KtSourceElement, nullableType: LighterASTNode, - allTypeModifiers: MutableList, + allTypeModifiers: MutableList, isNullable: Boolean = true ): FirTypeRef { lateinit var firType: FirTypeRef diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/TypeModifier.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/TypeModifier.kt deleted file mode 100644 index 4067d9d2cad..00000000000 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/fir/modifier/TypeModifier.kt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.fir.lightTree.fir.modifier - -class TypeModifier(suspendModifier: Long = ModifierFlag.NONE.value) : Modifier(suspendModifier) { - fun hasNoAnnotations(): Boolean = annotations.isEmpty() -}