[Analysis API] Add KtReferenceMutateService...

and delegate renaming and rebinding to this new service for `KtReference`.

In addition, CliKtFe10XXXReference are all removed because it seems they are not necessary because the IDE flavor differs only by handling renaming, which is moved to a separate service.
This commit is contained in:
Tianyu Geng
2022-05-02 22:09:58 +00:00
committed by Ilya Kirillov
parent 213e7154c2
commit b5139c958b
20 changed files with 79 additions and 149 deletions
@@ -9,7 +9,6 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -17,7 +16,7 @@ import org.jetbrains.kotlin.idea.references.KtArrayAccessReference
import org.jetbrains.kotlin.psi.KtArrayAccessExpression
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
abstract class KtFe10ArrayAccessReference(expression: KtArrayAccessExpression) : KtArrayAccessReference(expression), KtFe10Reference {
class KtFe10ArrayAccessReference(expression: KtArrayAccessExpression) : KtArrayAccessReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
require(this is KtFe10AnalysisSession)
@@ -25,10 +24,4 @@ abstract class KtFe10ArrayAccessReference(expression: KtArrayAccessExpression) :
val descriptor = expression.getResolvedCall(bindingContext)?.resultingDescriptor
return listOfNotNull(descriptor?.toKtCallableSymbol(analysisContext))
}
}
class CliKtFe10ArrayAccessReference(expression: KtArrayAccessExpression) : KtFe10ArrayAccessReference(expression), CliKtFe10Reference {
override fun handleElementRename(newElementName: String): PsiElement? {
throw NotImplementedError("Renaming is not supported")
}
}
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -16,7 +15,7 @@ import org.jetbrains.kotlin.idea.references.KtCollectionLiteralReference
import org.jetbrains.kotlin.psi.KtCollectionLiteralExpression
import org.jetbrains.kotlin.resolve.BindingContext
abstract class KtFe10CollectionLiteralReference(
class KtFe10CollectionLiteralReference(
expression: KtCollectionLiteralExpression
) : KtCollectionLiteralReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
@@ -27,7 +26,3 @@ abstract class KtFe10CollectionLiteralReference(
return listOfNotNull(descriptor?.toKtCallableSymbol(analysisContext))
}
}
internal class CliKtFe10CollectionLiteralReference(
expression: KtCollectionLiteralExpression
) : KtFe10CollectionLiteralReference(expression), CliKtFe10Reference
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -16,7 +15,7 @@ import org.jetbrains.kotlin.idea.references.KtConstructorDelegationReference
import org.jetbrains.kotlin.psi.KtConstructorDelegationReferenceExpression
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
abstract class KtFe10ConstructorDelegationReference(
class KtFe10ConstructorDelegationReference(
expression: KtConstructorDelegationReferenceExpression
) : KtConstructorDelegationReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
@@ -26,8 +25,4 @@ abstract class KtFe10ConstructorDelegationReference(
val descriptor = expression.getResolvedCall(bindingContext)?.resultingDescriptor
return listOfNotNull(descriptor?.toKtCallableSymbol(analysisContext))
}
}
internal class CliKtFe10ConstructorDelegationReference(
expression: KtConstructorDelegationReferenceExpression
) : KtFe10ConstructorDelegationReference(expression), CliKtFe10Reference
}
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -16,7 +15,7 @@ import org.jetbrains.kotlin.idea.references.KtDestructuringDeclarationReference
import org.jetbrains.kotlin.psi.KtDestructuringDeclarationEntry
import org.jetbrains.kotlin.resolve.BindingContext
abstract class KtFe10DestructuringDeclarationEntry(
class KtFe10DestructuringDeclarationEntry(
element: KtDestructuringDeclarationEntry
) : KtDestructuringDeclarationReference(element), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
@@ -27,11 +26,3 @@ abstract class KtFe10DestructuringDeclarationEntry(
return listOfNotNull(descriptor?.toKtCallableSymbol(analysisContext))
}
}
internal class CliKtFe10DestructuringDeclarationEntry(
element: KtDestructuringDeclarationEntry
) : KtFe10DestructuringDeclarationEntry(element), CliKtFe10Reference {
override fun canRename(): Boolean {
return false
}
}
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -15,7 +14,7 @@ import org.jetbrains.kotlin.idea.references.KtForLoopInReference
import org.jetbrains.kotlin.psi.KtForExpression
import org.jetbrains.kotlin.resolve.BindingContext
abstract class KtFe10ForLoopInReference(expression: KtForExpression) : KtForLoopInReference(expression), KtFe10Reference {
class KtFe10ForLoopInReference(expression: KtForExpression) : KtForLoopInReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
check(this is KtFe10AnalysisSession)
@@ -28,6 +27,4 @@ abstract class KtFe10ForLoopInReference(expression: KtForExpression) : KtForLoop
BindingContext.LOOP_RANGE_NEXT_RESOLVED_CALL
).mapNotNull { slice -> bindingContext[slice, loopRange]?.resultingDescriptor?.toKtCallableSymbol(analysisContext) }
}
}
internal class CliKtFe10ForLoopInReference(expression: KtForExpression) : KtFe10ForLoopInReference(expression), CliKtFe10Reference
}
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -20,7 +19,7 @@ import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
import org.jetbrains.kotlin.resolve.calls.util.getCall
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
abstract class KtFe10InvokeFunctionReference(expression: KtCallExpression) : KtInvokeFunctionReference(expression), KtFe10Reference {
class KtFe10InvokeFunctionReference(expression: KtCallExpression) : KtInvokeFunctionReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
require(this is KtFe10AnalysisSession)
@@ -38,11 +37,3 @@ abstract class KtFe10InvokeFunctionReference(expression: KtCallExpression) : KtI
return descriptors.mapNotNull { it.toKtCallableSymbol(analysisContext) }
}
}
internal class CliKtFe10InvokeFunctionReference(
expression: KtCallExpression
) : KtFe10InvokeFunctionReference(expression), CliKtFe10Reference {
override fun doRenameImplicitConventionalCall(newName: String?): KtExpression {
throw NotImplementedError("Renaming is not supported")
}
}
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.analysis.api.descriptors.references
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
@@ -17,7 +16,7 @@ import org.jetbrains.kotlin.psi.KtProperty
import org.jetbrains.kotlin.psi.KtPropertyDelegate
import org.jetbrains.kotlin.resolve.BindingContext
abstract class KtFe10PropertyDelegationMethodsReference(
class KtFe10PropertyDelegationMethodsReference(
expression: KtPropertyDelegate
) : KtPropertyDelegationMethodsReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
@@ -41,8 +40,4 @@ abstract class KtFe10PropertyDelegationMethodsReference(
return emptyList()
}
}
internal class CliKtFe10PropertyDelegationMethodsReference(
expression: KtPropertyDelegate
) : KtFe10PropertyDelegationMethodsReference(expression), CliKtFe10Reference
}
@@ -9,18 +9,16 @@ import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.analysis.api.KtAnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode
import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.CliKtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.references.base.KtFe10Reference
import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtImportAlias
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
abstract class KtFe10SimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleNameReference(expression), KtFe10Reference {
class KtFe10SimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleNameReference(expression), KtFe10Reference {
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
require(this is KtFe10AnalysisSession)
@@ -31,26 +29,8 @@ abstract class KtFe10SimpleNameReference(expression: KtSimpleNameExpression) : K
return listOfNotNull(descriptor?.toKtSymbol(analysisContext))
}
}
internal class CliKtFe10SimpleNameReference(
expression: KtSimpleNameExpression
) : KtFe10SimpleNameReference(expression), CliKtFe10Reference {
override fun isReferenceToViaExtension(element: PsiElement): Boolean {
return false
}
override fun handleElementRename(newElementName: String): PsiElement? {
throw NotImplementedError("Renaming is not supported")
}
override fun bindToElement(element: PsiElement, shorteningMode: ShorteningMode): PsiElement {
throw NotImplementedError("Binding is not supported")
}
override fun bindToFqName(fqName: FqName, shorteningMode: ShorteningMode, targetElement: PsiElement?): PsiElement {
throw NotImplementedError("Binding is not supported")
}
override fun isReferenceToViaExtension(element: PsiElement): Boolean = false
override fun getImportAlias(): KtImportAlias? {
return null
@@ -12,14 +12,14 @@ import org.jetbrains.kotlin.idea.references.KotlinReferenceProviderContributor
class KtFe10KotlinReferenceProviderContributor : KotlinReferenceProviderContributor {
override fun registerReferenceProviders(registrar: KotlinPsiReferenceRegistrar) {
with(registrar) {
registerProvider(factory = ::CliKtFe10SimpleNameReference)
registerProvider(factory = ::CliKtFe10ForLoopInReference)
registerProvider(factory = ::CliKtFe10InvokeFunctionReference)
registerProvider(factory = ::CliKtFe10PropertyDelegationMethodsReference)
registerProvider(factory = ::CliKtFe10DestructuringDeclarationEntry)
registerProvider(factory = ::CliKtFe10ArrayAccessReference)
registerProvider(factory = ::CliKtFe10ConstructorDelegationReference)
registerProvider(factory = ::CliKtFe10CollectionLiteralReference)
registerProvider(factory = ::KtFe10SimpleNameReference)
registerProvider(factory = ::KtFe10ForLoopInReference)
registerProvider(factory = ::KtFe10InvokeFunctionReference)
registerProvider(factory = ::KtFe10PropertyDelegationMethodsReference)
registerProvider(factory = ::KtFe10DestructuringDeclarationEntry)
registerProvider(factory = ::KtFe10ArrayAccessReference)
registerProvider(factory = ::KtFe10ConstructorDelegationReference)
registerProvider(factory = ::KtFe10CollectionLiteralReference)
}
}
}
@@ -21,11 +21,6 @@ import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
import org.jetbrains.kotlin.resolve.source.getPsi
internal interface CliKtFe10Reference : KtReference {
override val resolver: ResolveCache.PolyVariantResolver<KtReference>
get() = KtFe10PolyVariantResolver
}
object KtFe10PolyVariantResolver : ResolveCache.PolyVariantResolver<KtReference> {
@OptIn(KtAllowAnalysisOnEdt::class)
override fun resolve(reference: KtReference, incompleteCode: Boolean): Array<ResolveResult> {
@@ -5,7 +5,11 @@
package org.jetbrains.kotlin.analysis.api.descriptors.references.base
import com.intellij.psi.impl.source.resolve.ResolveCache
import org.jetbrains.kotlin.analysis.api.KtSymbolBasedReference
import org.jetbrains.kotlin.idea.references.KtReference
interface KtFe10Reference : KtReference, KtSymbolBasedReference
interface KtFe10Reference : KtReference, KtSymbolBasedReference {
override val resolver: ResolveCache.PolyVariantResolver<KtReference>
get() = KtFe10PolyVariantResolver
}
@@ -52,18 +52,6 @@ internal class KtFirSimpleNameReference(
return false
}
override fun handleElementRename(newElementName: String): PsiElement? {
TODO("Not yet implemented")
}
override fun bindToElement(element: PsiElement, shorteningMode: ShorteningMode): PsiElement {
TODO("Not yet implemented")
}
override fun bindToFqName(fqName: FqName, shorteningMode: ShorteningMode, targetElement: PsiElement?): PsiElement {
TODO("Not yet implemented")
}
override fun getImportAlias(): KtImportAlias? {
// TODO: Implement.
return null
@@ -23,6 +23,4 @@ class KtFirArrayAccessReference(
val fir = element.getOrBuildFirSafe<FirFunctionCall>(firResolveSession) ?: return emptyList()
return fir.getCandidateSymbols().map { it.fir.buildSymbol(firSymbolBuilder) }
}
override fun handleElementRename(newElementName: String): PsiElement = TODO("Not yet implemented")
}
@@ -15,10 +15,6 @@ import org.jetbrains.kotlin.psi.KtCallExpression
import org.jetbrains.kotlin.psi.KtExpression
class KtFirInvokeFunctionReference(expression: KtCallExpression) : KtInvokeFunctionReference(expression), KtFirReference {
override fun doRenameImplicitConventionalCall(newName: String?): KtExpression {
TODO("Not yet implemented")
}
override fun KtAnalysisSession.resolveToSymbols(): Collection<KtSymbol> {
return expression.resolveCall().calls.mapNotNull { call ->
(call as? KtSimpleFunctionCall)
@@ -28,8 +28,6 @@ abstract class KtArrayAccessReference(
override fun canRename() = true
abstract override fun handleElementRename(newElementName: String): PsiElement?
companion object {
private val NAMES = listOf(OperatorNameConventions.GET, OperatorNameConventions.SET)
}
@@ -19,17 +19,10 @@ abstract class KtDestructuringDeclarationReference(
override fun getRangeInElement() = TextRange(0, element.textLength)
abstract override fun canRename(): Boolean
override fun resolve() = multiResolve(false).asSequence()
.map { it.element }
.first { it is KtDestructuringDeclarationEntry }
override fun handleElementRename(newElementName: String): PsiElement? {
if (canRename()) return expression
throw IncorrectOperationException()
}
override val resolvesByNames: Collection<Name>
get() {
val destructuringParent = element.parent as? KtDestructuringDeclaration ?: return emptyList()
@@ -63,28 +63,6 @@ abstract class KtInvokeFunctionReference(expression: KtCallExpression) : KtSimpl
override fun canRename(): Boolean = true
override fun handleElementRename(newElementName: String): PsiElement? {
val callExpression = expression
val fullCallExpression = callExpression.getQualifiedExpressionForSelectorOrThis()
if (newElementName == OperatorNameConventions.GET.asString() && callExpression.typeArguments.isEmpty()) {
val arrayAccessExpression = KtPsiFactory(callExpression).buildExpression {
if (fullCallExpression is KtQualifiedExpression) {
appendExpression(fullCallExpression.receiverExpression)
appendFixedText(fullCallExpression.operationSign.value)
}
appendExpression(callExpression.calleeExpression)
appendFixedText("[")
appendExpressions(callExpression.valueArguments.map { it.getArgumentExpression() })
appendFixedText("]")
}
return fullCallExpression.replace(arrayAccessExpression)
}
return doRenameImplicitConventionalCall(newElementName)
}
protected abstract fun doRenameImplicitConventionalCall(newName: String?): KtExpression
companion object {
private val NAMES = listOf(OperatorNameConventions.INVOKE)
}
@@ -5,6 +5,8 @@
package org.jetbrains.kotlin.idea.references
import com.intellij.openapi.application.Application
import com.intellij.openapi.components.ServiceManager
import com.intellij.psi.*
import com.intellij.psi.impl.source.resolve.ResolveCache
import com.intellij.util.IncorrectOperationException
@@ -34,9 +36,18 @@ abstract class AbstractKtReference<T : KtElement>(element: T) : PsiPolyVariantRe
override fun getCanonicalText(): String = "<TBD>"
open fun canRename(): Boolean = false
override fun handleElementRename(newElementName: String): PsiElement? = throw IncorrectOperationException()
override fun handleElementRename(newElementName: String): PsiElement? =
if (canRename())
getKtReferenceMutateService().handleElementRename(this, newElementName)
else
null
override fun bindToElement(element: PsiElement): PsiElement = throw IncorrectOperationException()
override fun bindToElement(element: PsiElement): PsiElement =
getKtReferenceMutateService().bindToElement(this, element)
protected fun getKtReferenceMutateService(): KtReferenceMutateService =
ServiceManager.getService(KtReferenceMutateService::class.java)
?: throw IllegalStateException("Cannot handle element rename because KtReferenceMutateService is missing")
@Suppress("UNCHECKED_CAST")
override fun getVariants(): Array<Any> = PsiReference.EMPTY_ARRAY as Array<Any>
@@ -0,0 +1,36 @@
/*
* 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.
*/
package org.jetbrains.kotlin.idea.references
import com.intellij.psi.PsiElement
import org.jetbrains.kotlin.name.FqName
/**
* Service that is responsible for mutating PSI through [KtReference].
*
* This service is only needed by IDE to handle element renaming or change elements bound to a [KtReference].
*/
interface KtReferenceMutateService {
/**
* See [com.intellij.psi.PsiReference.handleElementRename].
*/
fun handleElementRename(ktReference: KtReference, newElementName: String): PsiElement?
/**
* See [com.intellij.psi.PsiReference.bindToElement].
*/
fun bindToElement(ktReference: KtReference, element: PsiElement): PsiElement
fun bindToElement(simpleNameReference: KtSimpleNameReference, element: PsiElement, shorteningMode: KtSimpleNameReference.ShorteningMode): PsiElement
fun bindToFqName(
simpleNameReference: KtSimpleNameReference,
fqName: FqName,
shorteningMode: KtSimpleNameReference.ShorteningMode = KtSimpleNameReference.ShorteningMode.DELAYED_SHORTENING,
targetElement: PsiElement? = null
): PsiElement
}
@@ -40,25 +40,21 @@ abstract class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSim
return true
}
abstract override fun handleElementRename(newElementName: String): PsiElement?
enum class ShorteningMode {
NO_SHORTENING,
DELAYED_SHORTENING,
FORCED_SHORTENING
}
// By default reference binding is delayed
override fun bindToElement(element: PsiElement): PsiElement =
bindToElement(element, ShorteningMode.DELAYED_SHORTENING)
fun bindToElement(element: PsiElement, shorteningMode: ShorteningMode = ShorteningMode.DELAYED_SHORTENING): PsiElement =
getKtReferenceMutateService().bindToElement(this, element, shorteningMode)
abstract fun bindToElement(element: PsiElement, shorteningMode: ShorteningMode): PsiElement
abstract fun bindToFqName(
fun bindToFqName(
fqName: FqName,
shorteningMode: ShorteningMode = ShorteningMode.DELAYED_SHORTENING,
targetElement: PsiElement? = null
): PsiElement
): PsiElement =
getKtReferenceMutateService().bindToFqName(this, fqName, shorteningMode, targetElement)
override fun getCanonicalText(): String = expression.text