[LC] do not store name identifier as property

^KT-56613
This commit is contained in:
Dmitrii Gridin
2023-02-23 17:49:18 +01:00
committed by Space Team
parent 327208fb8a
commit 58dc93da90
11 changed files with 26 additions and 49 deletions
@@ -75,11 +75,8 @@ abstract class SymbolLightClassForClassLike<SType : KtClassOrObjectSymbol> prote
abstract override fun getOwnFields(): List<KtLightField>
abstract override fun getOwnMethods(): List<PsiMethod>
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, classOrObjectDeclaration)
}
override fun getNameIdentifier(): PsiIdentifier? = _identifier
override fun getNameIdentifier(): PsiIdentifier? = KtLightIdentifier(this, classOrObjectDeclaration)
abstract override fun getExtendsList(): PsiReferenceList?
@@ -134,12 +134,8 @@ internal class SymbolLightClassForEnumEntry(
return super.isInheritor(baseClass, checkDeep = true)
}
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, kotlinOrigin)
}
// probably should be dropped after KT-54798
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, kotlinOrigin)
override fun getName(): String? = kotlinOrigin.name
override fun isDeprecated(): Boolean = false
@@ -14,7 +14,6 @@ import com.intellij.util.PlatformIcons
import org.jetbrains.annotations.NonNls
import org.jetbrains.kotlin.asJava.builder.LightMemberOrigin
import org.jetbrains.kotlin.asJava.classes.cannotModify
import org.jetbrains.kotlin.asJava.classes.lazyPub
import org.jetbrains.kotlin.asJava.elements.KtLightField
import org.jetbrains.kotlin.asJava.elements.KtLightIdentifier
import org.jetbrains.kotlin.idea.KotlinLanguage
@@ -37,11 +36,7 @@ internal abstract class SymbolLightField protected constructor(
override fun hasInitializer(): Boolean = initializer !== null
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, kotlinOrigin)
}
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, kotlinOrigin)
override fun computeConstantValue(): Any? = null
@@ -229,11 +229,7 @@ internal class SymbolLightAccessorMethod private constructor(
override fun isDeprecated(): Boolean = _isDeprecated
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, containingPropertyDeclaration)
}
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, containingPropertyDeclaration)
private val _returnedType: PsiType by lazyPub {
if (!isGetter) return@lazyPub PsiType.VOID
@@ -108,10 +108,6 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
}
}
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, functionDeclaration)
}
private val _isDeprecated: Boolean by lazyPub {
withFunctionSymbol { functionSymbol ->
functionSymbol.hasDeprecatedAnnotation()
@@ -120,7 +116,7 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
override fun isDeprecated(): Boolean = _isDeprecated
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, functionDeclaration)
override fun getParameterList(): PsiParameterList = _parametersList
@@ -28,11 +28,7 @@ internal class SymbolLightNoArgConstructor(
override fun getTypeParameterList(): PsiTypeParameterList? = null
override fun getTypeParameters(): Array<PsiTypeParameter> = PsiTypeParameter.EMPTY_ARRAY
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, ktDeclaration = null)
}
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, ktDeclaration = null)
override fun isDeprecated(): Boolean = false
@@ -48,10 +48,6 @@ internal abstract class SymbolLightParameterCommon(
abstract override fun getModifierList(): PsiModifierList
private val _identifier: PsiIdentifier by lazyPub {
KtLightIdentifier(this, parameterDeclaration)
}
protected fun nullabilityType(): NullabilityType {
if (isVarArgs) return NullabilityType.NotNull
@@ -65,7 +61,7 @@ internal abstract class SymbolLightParameterCommon(
}
}
override fun getNameIdentifier(): PsiIdentifier = _identifier
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, parameterDeclaration)
private val _type by lazyPub {
parameterSymbolPointer.withSymbol(ktModule) { parameterSymbol ->