[LC] do not store name identifier as property
^KT-56613
This commit is contained in:
committed by
Space Team
parent
327208fb8a
commit
58dc93da90
+1
-3
@@ -37,8 +37,6 @@ abstract class KtLightClassForSourceDeclaration(
|
||||
StubBasedPsiElement<KotlinClassOrObjectStub<out KtClassOrObject>> {
|
||||
override fun cacheDependencies(): List<Any> = classOrObject.getExternalDependencies()
|
||||
|
||||
private val lightIdentifier = KtLightIdentifier(this, classOrObject)
|
||||
|
||||
override fun getText() = kotlinOrigin.text ?: ""
|
||||
|
||||
override fun getTextRange(): TextRange? = kotlinOrigin.textRange ?: TextRange.EMPTY_RANGE
|
||||
@@ -133,7 +131,7 @@ abstract class KtLightClassForSourceDeclaration(
|
||||
override fun getElementType(): IStubElementType<out StubElement<*>, *>? = classOrObject.elementType
|
||||
override fun getStub(): KotlinClassOrObjectStub<out KtClassOrObject>? = classOrObject.stub
|
||||
|
||||
override fun getNameIdentifier(): KtLightIdentifier? = lightIdentifier
|
||||
override fun getNameIdentifier(): KtLightIdentifier? = KtLightIdentifier(this, classOrObject)
|
||||
|
||||
override fun getExtendsList(): PsiReferenceList? = _extendsList
|
||||
override fun getImplementsList(): PsiReferenceList? = _implementsList
|
||||
|
||||
+11
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -36,4 +36,14 @@ open class KtLightIdentifier @JvmOverloads constructor(
|
||||
override fun getTextRange(): TextRange = origin?.textRange ?: TextRange.EMPTY_RANGE
|
||||
|
||||
override fun getTextOffset(): Int = origin?.textOffset ?: -1
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other === this ||
|
||||
other is KtLightIdentifier &&
|
||||
other.lightOwner == lightOwner &&
|
||||
other.ktDeclaration == ktDeclaration &&
|
||||
other.name == name
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = lightOwner.hashCode()
|
||||
}
|
||||
|
||||
+2
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.intellij.psi.PsiModifierList
|
||||
import com.intellij.psi.javadoc.PsiDocComment
|
||||
import org.jetbrains.kotlin.asJava.builder.LightMemberOriginForDeclaration
|
||||
import org.jetbrains.kotlin.asJava.classes.KtLightClass
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
|
||||
@@ -20,8 +19,6 @@ abstract class KtLightMemberImpl<out D : PsiMember>(
|
||||
override val lightMemberOrigin: LightMemberOriginForDeclaration?,
|
||||
private val containingClass: KtLightClass,
|
||||
) : KtLightElementBase(containingClass), PsiMember, KtLightMember<D> {
|
||||
private val lightIdentifier by lazyPub { KtLightIdentifier(this, kotlinOrigin as? KtNamedDeclaration) }
|
||||
|
||||
abstract override fun hasModifierProperty(name: String): Boolean
|
||||
|
||||
abstract override fun getModifierList(): PsiModifierList?
|
||||
@@ -32,7 +29,7 @@ abstract class KtLightMemberImpl<out D : PsiMember>(
|
||||
|
||||
abstract override fun getName(): String
|
||||
|
||||
override fun getNameIdentifier(): PsiIdentifier = lightIdentifier
|
||||
override fun getNameIdentifier(): PsiIdentifier = KtLightIdentifier(this, kotlinOrigin as? KtNamedDeclaration)
|
||||
|
||||
override val kotlinOrigin: KtDeclaration? get() = lightMemberOrigin?.originalElement
|
||||
|
||||
|
||||
Reference in New Issue
Block a user