[LL FIR] rename collectDesignation to collectDesignationWithOptionalFile

To make the choice more visible

^KT-65344
This commit is contained in:
Dmitrii Gridin
2024-02-05 19:56:09 +01:00
committed by Space Team
parent 3c26d0e85d
commit 0b4dac9d8d
2 changed files with 11 additions and 11 deletions
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.analysis.api.fir.types.qualifiers
import org.jetbrains.kotlin.analysis.api.fir.KtSymbolByFirBuilder
import org.jetbrains.kotlin.analysis.api.types.KtClassTypeQualifier
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.toSequence
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.tryCollectDesignation
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.tryCollectDesignationWithOptionalFile
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
import org.jetbrains.kotlin.fir.containingClassForLocal
import org.jetbrains.kotlin.fir.declarations.*
@@ -46,7 +46,7 @@ internal object UsualClassTypeQualifierBuilder {
}
val designation = classSymbolToRender.fir.let {
val nonLocalDesignation = it.tryCollectDesignation()
val nonLocalDesignation = it.tryCollectDesignationWithOptionalFile()
nonLocalDesignation?.toSequence(includeTarget = true)?.toList() ?: collectDesignationPathForLocal(it)
}.filterIsInstance<FirRegularClass>()
@@ -313,19 +313,19 @@ private fun findKotlinStdlibClass(classId: ClassId, target: FirDeclaration): Fir
*
* @see collectDesignationWithFile
* @see tryCollectDesignationWithFile
* @see tryCollectDesignation
* @see tryCollectDesignationWithOptionalFile
*/
fun FirElementWithResolveState.collectDesignation(providedFile: FirFile? = null): FirDesignation =
tryCollectDesignation(providedFile) ?: errorWithAttachment("No designation of local declaration") {
fun FirElementWithResolveState.collectDesignationWithOptionalFile(providedFile: FirFile? = null): FirDesignation =
tryCollectDesignationWithOptionalFile(providedFile) ?: errorWithAttachment("No designation of local declaration") {
providedFile?.let { withFirEntry("firFile", it) }
}
/**
* @return [FirDesignation] where [FirDesignation.fileOrNull] not null or throws an exception.
*
* @see collectDesignation
* @see collectDesignationWithOptionalFile
* @see tryCollectDesignationWithFile
* @see tryCollectDesignation
* @see tryCollectDesignationWithOptionalFile
*/
fun FirElementWithResolveState.collectDesignationWithFile(providedFile: FirFile? = null): FirDesignation =
tryCollectDesignationWithFile(providedFile) ?: errorWithAttachment("No designation of local declaration") {
@@ -337,19 +337,19 @@ fun FirElementWithResolveState.collectDesignationWithFile(providedFile: FirFile?
*
* @return [FirDesignation] where [FirDesignation.fileOrNull] can be null or null.
*
* @see collectDesignation
* @see collectDesignationWithOptionalFile
* @see collectDesignationWithFile
* @see tryCollectDesignationWithFile
*/
fun FirElementWithResolveState.tryCollectDesignation(providedFile: FirFile? = null): FirDesignation? =
fun FirElementWithResolveState.tryCollectDesignationWithOptionalFile(providedFile: FirFile? = null): FirDesignation? =
tryCollectDesignation(providedFile = providedFile, target = this)
/**
* @return [FirDesignation] with not-null [FirDesignation.file] or null.
*
* @see collectDesignationWithFile
* @see tryCollectDesignation
* @see collectDesignation
* @see tryCollectDesignationWithOptionalFile
* @see collectDesignationWithOptionalFile
*/
fun FirElementWithResolveState.tryCollectDesignationWithFile(providedFile: FirFile? = null): FirDesignation? = when (this) {
is FirSyntheticProperty, is FirSyntheticPropertyAccessor -> unexpectedElementError<FirElementWithResolveState>(this)