[LC] KtLightIdentifierBase: add missing copy

^KT-54051
This commit is contained in:
Dmitrii Gridin
2022-11-16 08:30:52 +01:00
committed by Space Team
parent 43561a935c
commit 577bc243d2
2 changed files with 4 additions and 0 deletions
@@ -20,12 +20,15 @@ abstract class KtLightIdentifierBase(
override fun getContainingFile() = lightOwner.containingFile
override fun getTextRange() = origin?.textRange ?: TextRange.EMPTY_RANGE
override fun getTextOffset(): Int = origin?.textOffset ?: -1
abstract override fun copy(): PsiElement
}
open class KtLightIdentifier(
lightOwner: PsiElement,
private val ktDeclaration: KtDeclaration?
) : KtLightIdentifierBase(lightOwner, ktDeclaration?.name) {
override fun copy(): PsiElement = KtLightIdentifier(parent, ktDeclaration)
override val origin: PsiElement?
get() = when (ktDeclaration) {
is KtSecondaryConstructor -> ktDeclaration.getConstructorKeyword()
@@ -19,6 +19,7 @@ internal class SymbolLightIdentifier(
lightOwner: PsiElement,
private val ktSymbol: KtSymbol?
) : KtLightIdentifierBase(lightOwner, (ktSymbol as? KtNamedSymbol)?.name?.identifierOrNullIfSpecial) {
override fun copy(): PsiElement = SymbolLightIdentifier(parent, ktSymbol)
override val origin: PsiElement?
get() = when (val ktDeclaration = ktSymbol?.psi) {