[LL FIR] LLFirResolveTarget: move util to a separate file
^KT-61296
This commit is contained in:
committed by
Space Team
parent
53584cdd49
commit
3432e8d1f9
-14
@@ -61,17 +61,3 @@ sealed class LLFirResolveTarget(
|
||||
|
||||
protected abstract fun toStringForTarget(): String
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the target to the specified [phase].
|
||||
* The owning session must be a resolvable one.
|
||||
*/
|
||||
fun LLFirResolveTarget.resolve(phase: FirResolvePhase) {
|
||||
val session = firFile.llFirResolvableSession
|
||||
?: errorWithAttachment("Resolvable session expected, got '${firFile.llFirSession::class.java}'") {
|
||||
withEntry("firSession", firFile.llFirSession) { it.toString() }
|
||||
}
|
||||
|
||||
val lazyDeclarationResolver = session.moduleComponents.firModuleLazyDeclarationResolver
|
||||
lazyDeclarationResolver.lazyResolveTarget(this, phase, towerDataContextCollector = null)
|
||||
}
|
||||
+19
-1
@@ -6,11 +6,29 @@
|
||||
package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets
|
||||
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirResolvableSession
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession
|
||||
import org.jetbrains.kotlin.fir.FirElementWithResolveState
|
||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
|
||||
fun LLFirResolveTarget.forEachPathElementAndTarget(action: (FirElementWithResolveState) -> Unit) {
|
||||
path.forEach(action)
|
||||
forEachTarget(action)
|
||||
}
|
||||
|
||||
fun FirDesignationWithFile.asResolveTarget(): LLFirSingleResolveTarget = LLFirSingleResolveTarget(firFile, path, target)
|
||||
fun FirDesignationWithFile.asResolveTarget(): LLFirSingleResolveTarget = LLFirSingleResolveTarget(firFile, path, target)
|
||||
|
||||
/**
|
||||
* Resolves the target to the specified [phase].
|
||||
* The owning session must be a resolvable one.
|
||||
*/
|
||||
fun LLFirResolveTarget.resolve(phase: FirResolvePhase) {
|
||||
val session = firFile.llFirResolvableSession
|
||||
?: errorWithAttachment("Resolvable session expected, got '${firFile.llFirSession::class.java}'") {
|
||||
withEntry("firSession", firFile.llFirSession) { it.toString() }
|
||||
}
|
||||
|
||||
val lazyDeclarationResolver = session.moduleComponents.firModuleLazyDeclarationResolver
|
||||
lazyDeclarationResolver.lazyResolveTarget(this, phase, towerDataContextCollector = null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user