FIR IDE: change KtPropertySymbol inheritors cratePointer to return specific symbols
This commit is contained in:
+1
-1
@@ -106,7 +106,7 @@ internal class KtFirKotlinPropertySymbol(
|
||||
override val hasGetter: Boolean get() = firRef.withFir { it.getter != null }
|
||||
override val hasSetter: Boolean get() = firRef.withFir { it.setter != null }
|
||||
|
||||
override fun createPointer(): KtSymbolPointer<KtPropertySymbol> {
|
||||
override fun createPointer(): KtSymbolPointer<KtKotlinPropertySymbol> {
|
||||
KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it }
|
||||
return when (symbolKind) {
|
||||
KtSymbolKind.TOP_LEVEL -> TODO("Creating symbol for top level fun is not supported yet")
|
||||
|
||||
+2
-11
@@ -87,16 +87,7 @@ internal class KtFirSyntheticJavaPropertySymbol(
|
||||
|
||||
override val origin: KtSymbolOrigin get() = withValidityAssertion { KtSymbolOrigin.JAVA_SYNTHETIC_PROPERTY }
|
||||
|
||||
override fun createPointer(): KtSymbolPointer<KtPropertySymbol> {
|
||||
KtPsiBasedSymbolPointer.createForSymbolFromSource(this)?.let { return it }
|
||||
return when (symbolKind) {
|
||||
KtSymbolKind.TOP_LEVEL -> TODO("Creating symbol for top level fun is not supported yet")
|
||||
KtSymbolKind.NON_PROPERTY_PARAMETER -> TODO("Creating symbol for top level parameters is not supported yet")
|
||||
KtSymbolKind.MEMBER -> KtFirMemberPropertySymbolPointer(
|
||||
firRef.withFir { it.containingClass()?.classId ?: error("ClassId should not be null for member property") },
|
||||
firRef.withFir { it.createSignature() }
|
||||
)
|
||||
KtSymbolKind.LOCAL -> throw CanNotCreateSymbolPointerForLocalLibraryDeclarationException(name.asString())
|
||||
}
|
||||
override fun createPointer(): KtSymbolPointer<KtSyntheticJavaPropertySymbol> {
|
||||
TODO("pointers to KtSyntheticJavaPropertySymbol is not supported yet")
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -9,20 +9,20 @@ import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirProperty
|
||||
import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtKotlinPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
internal class KtFirMemberPropertySymbolPointer(
|
||||
ownerClassId: ClassId,
|
||||
private val signature: IdSignature
|
||||
) : KtFirMemberSymbolPointer<KtPropertySymbol>(ownerClassId) {
|
||||
) : KtFirMemberSymbolPointer<KtKotlinPropertySymbol>(ownerClassId) {
|
||||
override fun KtFirAnalysisSession.chooseCandidateAndCreateSymbol(
|
||||
candidates: Collection<FirDeclaration>,
|
||||
firSession: FirSession
|
||||
): KtPropertySymbol? {
|
||||
): KtKotlinPropertySymbol? {
|
||||
val firProperty = candidates.findDeclarationWithSignature<FirProperty>(signature, firSession) ?: return null
|
||||
return firSymbolBuilder.variableLikeBuilder.buildVariableSymbol(firProperty) as? KtPropertySymbol
|
||||
return firSymbolBuilder.variableLikeBuilder.buildVariableSymbol(firProperty) as? KtKotlinPropertySymbol
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user