[Analysis API] extract the data from the ShortenCommandImpl to the base class

^KT-58992
This commit is contained in:
Ilya Kirillov
2023-05-30 18:16:42 +02:00
committed by Space Team
parent fffc921d42
commit 95cf892eec
4 changed files with 28 additions and 26 deletions
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
import org.jetbrains.kotlin.analysis.api.symbols.KtCallableSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtClassLikeSymbol
import org.jetbrains.kotlin.analysis.api.symbols.KtEnumEntrySymbol
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
@@ -118,12 +119,14 @@ public interface KtReferenceShortenerMixIn : KtAnalysisSessionMixIn {
}
public interface ShortenCommand {
/**
* Shortens target elements, adds necessary import, and returns a list of the shortened result elements.
*/
public fun invokeShortening(): List<KtElement>
public val targetFile: SmartPsiElementPointer<KtFile>
public val importsToAdd: List<FqName>
public val starImportsToAdd: List<FqName>
public val typesToShorten: List<SmartPsiElementPointer<KtUserType>>
public val qualifiersToShorten: List<SmartPsiElementPointer<KtDotQualifiedExpression>>
public val isEmpty: Boolean
public fun getTypesToShorten(): List<SmartPsiElementPointer<KtUserType>>
public fun getQualifiersToShorten(): List<SmartPsiElementPointer<KtDotQualifiedExpression>>
get() = typesToShorten.isEmpty() && qualifiersToShorten.isEmpty()
public fun invokeShortening(): List<KtElement>
}