K2: Remove redundant TypeModifier class
This commit is contained in:
committed by
Space Team
parent
b7bd078a31
commit
03e06be324
+5
-6
@@ -35,7 +35,6 @@ import org.jetbrains.kotlin.fir.expressions.builder.*
|
|||||||
import org.jetbrains.kotlin.fir.expressions.impl.FirSingleExpressionBlock
|
import org.jetbrains.kotlin.fir.expressions.impl.FirSingleExpressionBlock
|
||||||
import org.jetbrains.kotlin.fir.lightTree.fir.*
|
import org.jetbrains.kotlin.fir.lightTree.fir.*
|
||||||
import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier
|
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.TypeParameterModifier
|
||||||
import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier
|
import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier
|
||||||
import org.jetbrains.kotlin.fir.references.builder.buildExplicitSuperReference
|
import org.jetbrains.kotlin.fir.references.builder.buildExplicitSuperReference
|
||||||
@@ -270,8 +269,8 @@ class LightTreeRawFirDeclarationBuilder(
|
|||||||
/**
|
/**
|
||||||
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseTypeModifierList
|
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseTypeModifierList
|
||||||
*/
|
*/
|
||||||
private fun convertTypeModifierList(modifiers: LighterASTNode): TypeModifier {
|
private fun convertTypeModifierList(modifiers: LighterASTNode): Modifier {
|
||||||
val typeModifier = TypeModifier()
|
val typeModifier = Modifier()
|
||||||
modifiers.forEachChildren {
|
modifiers.forEachChildren {
|
||||||
when (it.tokenType) {
|
when (it.tokenType) {
|
||||||
ANNOTATION -> typeModifier.annotations += convertAnnotation(it)
|
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
|
// 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?
|
// TODO: Report MODIFIER_LIST_NOT_ALLOWED error when there are multiple modifier lists. How do we report on each of them?
|
||||||
val allTypeModifiers = mutableListOf<TypeModifier>()
|
val allTypeModifiers = mutableListOf<Modifier>()
|
||||||
|
|
||||||
var firType: FirTypeRef? = null
|
var firType: FirTypeRef? = null
|
||||||
type.forEachChildren {
|
type.forEachChildren {
|
||||||
@@ -2075,7 +2074,7 @@ class LightTreeRawFirDeclarationBuilder(
|
|||||||
return calculatedFirType
|
return calculatedFirType
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Collection<TypeModifier>.hasSuspend() = any { it.hasSuspend() }
|
private fun Collection<Modifier>.hasSuspend() = any { it.hasSuspend() }
|
||||||
|
|
||||||
private fun convertIntersectionType(typeRefSource: KtSourceElement, intersectionType: LighterASTNode, isNullable: Boolean): FirTypeRef {
|
private fun convertIntersectionType(typeRefSource: KtSourceElement, intersectionType: LighterASTNode, isNullable: Boolean): FirTypeRef {
|
||||||
val children = arrayListOf<FirTypeRef>()
|
val children = arrayListOf<FirTypeRef>()
|
||||||
@@ -2120,7 +2119,7 @@ class LightTreeRawFirDeclarationBuilder(
|
|||||||
private fun convertNullableType(
|
private fun convertNullableType(
|
||||||
typeRefSource: KtSourceElement,
|
typeRefSource: KtSourceElement,
|
||||||
nullableType: LighterASTNode,
|
nullableType: LighterASTNode,
|
||||||
allTypeModifiers: MutableList<TypeModifier>,
|
allTypeModifiers: MutableList<Modifier>,
|
||||||
isNullable: Boolean = true
|
isNullable: Boolean = true
|
||||||
): FirTypeRef {
|
): FirTypeRef {
|
||||||
lateinit var firType: FirTypeRef
|
lateinit var firType: FirTypeRef
|
||||||
|
|||||||
-10
@@ -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()
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user