From dfc75f34474c78950655086e0fbf4683937deb54 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Fri, 17 Jul 2020 11:53:16 +0300 Subject: [PATCH] FIR: Support fake elements for light tree --- .../tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt index 8a2fee2b789..b67f60730a5 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirSourceElement.kt @@ -167,7 +167,7 @@ class FirFakeSourceElement(psi: P, override val kind: FirFak fun FirSourceElement.fakeElement(newKind: FirFakeSourceElementKind): FirSourceElement { return when (this) { - is FirLightSourceElement -> this + is FirLightSourceElement -> FirLightSourceElement(element, startOffset, endOffset, tree, newKind) is FirPsiSourceElement<*> -> FirFakeSourceElement(psi, newKind) } } @@ -176,12 +176,11 @@ class FirLightSourceElement( val element: LighterASTNode, override val startOffset: Int, override val endOffset: Int, - val tree: FlyweightCapableTreeStructure + val tree: FlyweightCapableTreeStructure, + override val kind: FirSourceElementKind = FirRealSourceElementKind, ) : FirSourceElement() { override val elementType: IElementType get() = element.tokenType - - override val kind: FirSourceElementKind get() = FirRealSourceElementKind } val FirSourceElement?.psi: PsiElement? get() = (this as? FirPsiSourceElement<*>)?.psi