[AA] fe10 symbols adjusted to be used in goto type declaration

- try to find sources for decompiled symbols in IDE mode
- function literals can't be declared as extensions,
though there target can contain that indication,
let's take what descriptor provides
This commit is contained in:
Anna Kozlova
2023-06-07 14:25:39 +02:00
committed by teamcity
parent 86bed92a46
commit 983d319a6b
2 changed files with 6 additions and 5 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
import org.jetbrains.kotlin.descriptors.SourceElement
import org.jetbrains.kotlin.descriptors.annotations.Annotations
import org.jetbrains.kotlin.references.fe10.base.KtFe10ReferenceResolutionHelper
import org.jetbrains.kotlin.resolve.source.PsiSourceElement
internal interface KtFe10DescSymbol<T : DeclarationDescriptor> : KtFe10Symbol, KtFe10AnnotatedSymbol {
@@ -28,7 +29,11 @@ internal interface KtFe10DescSymbol<T : DeclarationDescriptor> : KtFe10Symbol, K
}
override val psi: PsiElement?
get() = withValidityAssertion { (source as? PsiSourceElement)?.psi }
get() = withValidityAssertion {
(source as? PsiSourceElement)?.psi
?: KtFe10ReferenceResolutionHelper.getInstance()
?.findDecompiledDeclaration(analysisContext.resolveSession.project, descriptor, null)
}
override val origin: KtSymbolOrigin
get() = withValidityAssertion { descriptor.getSymbolOrigin(analysisContext) }
@@ -59,10 +59,6 @@ internal class KtFe10PsiLiteralAnonymousFunctionSymbol(
override val receiverParameter: KtReceiverParameterSymbol?
get() = withValidityAssertion {
if (!psi.isExtensionDeclaration()) {
return null
}
descriptor?.extensionReceiverParameter?.toKtReceiverParameterSymbol(analysisContext)
}