[AA] KtSymbolPointer: introduce pointsToTheSameSymbolAs method
^KT-55191
This commit is contained in:
committed by
Space Team
parent
19a0a1fcd8
commit
13917887e0
+5
@@ -37,6 +37,11 @@ public class KtPsiBasedSymbolPointer<S : KtSymbol> private constructor(
|
||||
return symbol as S
|
||||
}
|
||||
|
||||
override fun pointsToTheSameSymbolAs(other: KtSymbolPointer<KtSymbol>): Boolean = this === other ||
|
||||
other is KtPsiBasedSymbolPointer &&
|
||||
other.expectedClass == expectedClass &&
|
||||
other.psiPointer == psiPointer
|
||||
|
||||
public constructor(psi: KtElement, expectedClass: KClass<S>) : this(psi.createSmartPointer(), expectedClass)
|
||||
|
||||
public companion object {
|
||||
|
||||
+6
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,11 @@ public abstract class KtSymbolPointer<out S : KtSymbol> {
|
||||
*/
|
||||
@Deprecated("Consider using org.jetbrains.kotlin.analysis.api.KtAnalysisSession.restoreSymbol")
|
||||
public abstract fun restoreSymbol(analysisSession: KtAnalysisSession): S?
|
||||
|
||||
/**
|
||||
* @return **true** if [other] pointer should be restored to the same symbol
|
||||
*/
|
||||
public open fun pointsToTheSameSymbolAs(other: KtSymbolPointer<KtSymbol>): Boolean = this === other
|
||||
}
|
||||
|
||||
public inline fun <S : KtSymbol> symbolPointer(crossinline getSymbol: (KtAnalysisSession) -> S?): KtSymbolPointer<S> =
|
||||
|
||||
Reference in New Issue
Block a user