[SLC] SymbolLightTypeParameter: drop redundant typeParameterDeclaration
Now we can replace it with kotlinOrigin ^KT-64772
This commit is contained in:
committed by
Space Team
parent
042042768f
commit
255a2d27f7
+10
-14
@@ -36,7 +36,6 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
private val parent: SymbolLightTypeParameterList,
|
||||
private val index: Int,
|
||||
private val typeParameterSymbolPointer: KtSymbolPointer<KtTypeParameterSymbol>,
|
||||
private val typeParameterDeclaration: KtTypeParameter?,
|
||||
override val kotlinOrigin: KtTypeParameter?,
|
||||
) : LightElement(parent.manager, KotlinLanguage.INSTANCE), PsiTypeParameter,
|
||||
KtLightDeclaration<KtTypeParameter, PsiTypeParameter> {
|
||||
@@ -50,7 +49,6 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
parent = parent,
|
||||
index = index,
|
||||
typeParameterSymbolPointer = with(ktAnalysisSession) { typeParameterSymbol.createPointer() },
|
||||
typeParameterDeclaration = typeParameterSymbol.sourcePsiSafe(),
|
||||
kotlinOrigin = typeParameterSymbol.sourcePsiSafe(),
|
||||
)
|
||||
|
||||
@@ -67,7 +65,6 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
parent,
|
||||
index,
|
||||
typeParameterSymbolPointer,
|
||||
typeParameterDeclaration,
|
||||
kotlinOrigin,
|
||||
)
|
||||
|
||||
@@ -161,7 +158,7 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
//End of PsiClass simple implementation
|
||||
|
||||
private val _name: String by lazyPub {
|
||||
typeParameterDeclaration?.name ?: withTypeParameterSymbol { it.name.asString() }
|
||||
kotlinOrigin?.name ?: withTypeParameterSymbol { it.name.asString() }
|
||||
}
|
||||
|
||||
override fun getName(): String = _name
|
||||
@@ -178,25 +175,24 @@ internal class SymbolLightTypeParameter private constructor(
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is SymbolLightTypeParameter || other.ktModule != ktModule || other.index != index) return false
|
||||
if (typeParameterDeclaration != null || other.typeParameterDeclaration != null) {
|
||||
return other.typeParameterDeclaration == typeParameterDeclaration
|
||||
if (kotlinOrigin != null || other.kotlinOrigin != null) {
|
||||
return other.kotlinOrigin == kotlinOrigin
|
||||
}
|
||||
|
||||
return other.kotlinOrigin == kotlinOrigin &&
|
||||
compareSymbolPointers(typeParameterSymbolPointer, other.typeParameterSymbolPointer) &&
|
||||
return compareSymbolPointers(typeParameterSymbolPointer, other.typeParameterSymbolPointer) &&
|
||||
other.parent == parent
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = typeParameterDeclaration?.hashCode() ?: name.hashCode()
|
||||
override fun hashCode(): Int = kotlinOrigin?.hashCode() ?: name.hashCode()
|
||||
override fun isEquivalentTo(another: PsiElement): Boolean {
|
||||
return basicIsEquivalentTo(this, another) || isOriginEquivalentTo(another)
|
||||
}
|
||||
|
||||
override fun getText(): String? = typeParameterDeclaration?.text
|
||||
override fun getTextRange(): TextRange? = typeParameterDeclaration?.textRange
|
||||
override fun getText(): String? = kotlinOrigin?.text
|
||||
override fun getTextRange(): TextRange? = kotlinOrigin?.textRange
|
||||
override fun getContainingFile(): PsiFile = parent.containingFile
|
||||
override fun getTextOffset(): Int = typeParameterDeclaration?.startOffset ?: -1
|
||||
override fun getStartOffsetInParent(): Int = typeParameterDeclaration?.startOffsetInParent ?: -1
|
||||
override fun getTextOffset(): Int = kotlinOrigin?.startOffset ?: -1
|
||||
override fun getStartOffsetInParent(): Int = kotlinOrigin?.startOffsetInParent ?: -1
|
||||
|
||||
override fun isValid(): Boolean = super.isValid() && typeParameterDeclaration?.isValid ?: typeParameterSymbolPointer.isValid(ktModule)
|
||||
override fun isValid(): Boolean = super.isValid() && kotlinOrigin?.isValid ?: typeParameterSymbolPointer.isValid(ktModule)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user