[LL FIR] remove checkPce parameter from resolve, now we always check for PCE
This commit is contained in:
-1
@@ -22,7 +22,6 @@ internal class LLFirLazyDeclarationResolver : FirLazyDeclarationResolver() {
|
|||||||
target = fir,
|
target = fir,
|
||||||
scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(),
|
scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(),
|
||||||
toPhase = toPhase,
|
toPhase = toPhase,
|
||||||
checkPCE = true,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -202,7 +202,6 @@ object LowLevelFirApiFacadeForResolveOnAir {
|
|||||||
|
|
||||||
declarationResolver.runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
declarationResolver.runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
||||||
FirDesignationWithFile(path = emptyList(), target = fileAnnotationsContainer, firFile),
|
FirDesignationWithFile(path = emptyList(), target = fileAnnotationsContainer, firFile),
|
||||||
checkPCE = true,
|
|
||||||
onAirCreatedDeclaration = true,
|
onAirCreatedDeclaration = true,
|
||||||
collector
|
collector
|
||||||
)
|
)
|
||||||
@@ -248,7 +247,7 @@ object LowLevelFirApiFacadeForResolveOnAir {
|
|||||||
|
|
||||||
val isInBodyReplacement = isInBodyReplacement(nonLocalDeclaration, replacement)
|
val isInBodyReplacement = isInBodyReplacement(nonLocalDeclaration, replacement)
|
||||||
|
|
||||||
return firResolveSession.globalComponents.lockProvider.runCustomResolveUnderLock(originalFirFile, true) {
|
return firResolveSession.globalComponents.lockProvider.runCustomResolveUnderLock(originalFirFile) {
|
||||||
val copiedFirDeclaration = if (isInBodyReplacement) {
|
val copiedFirDeclaration = if (isInBodyReplacement) {
|
||||||
when (originalDeclaration) {
|
when (originalDeclaration) {
|
||||||
is FirSimpleFunction ->
|
is FirSimpleFunction ->
|
||||||
@@ -272,7 +271,6 @@ object LowLevelFirApiFacadeForResolveOnAir {
|
|||||||
resolvableSession.moduleComponents.firModuleLazyDeclarationResolver
|
resolvableSession.moduleComponents.firModuleLazyDeclarationResolver
|
||||||
.runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
.runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
||||||
designation = onAirDesignation,
|
designation = onAirDesignation,
|
||||||
checkPCE = true,
|
|
||||||
onAirCreatedDeclaration = onAirCreatedDeclaration,
|
onAirCreatedDeclaration = onAirCreatedDeclaration,
|
||||||
towerDataContextCollector = collector,
|
towerDataContextCollector = collector,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-7
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder
|
package org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder
|
||||||
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
|
||||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.lockWithPCECheck
|
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.lockWithPCECheck
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||||
import java.util.concurrent.locks.ReentrantLock
|
import java.util.concurrent.locks.ReentrantLock
|
||||||
import kotlin.concurrent.withLock
|
import kotlin.concurrent.withLock
|
||||||
|
|
||||||
@@ -32,12 +32,7 @@ internal class LLFirLockProvider {
|
|||||||
*/
|
*/
|
||||||
internal inline fun <R> LLFirLockProvider.runCustomResolveUnderLock(
|
internal inline fun <R> LLFirLockProvider.runCustomResolveUnderLock(
|
||||||
firFile: FirFile,
|
firFile: FirFile,
|
||||||
checkPCE: Boolean,
|
|
||||||
body: () -> R
|
body: () -> R
|
||||||
): R {
|
): R {
|
||||||
return if (checkPCE) {
|
return withWriteLockPCECheck(key = firFile, lockingIntervalMs = 50L, body)
|
||||||
withWriteLockPCECheck(key = firFile, lockingIntervalMs = 50L, body)
|
|
||||||
} else {
|
|
||||||
withWriteLock(key = firFile, action = body)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
-1
@@ -119,7 +119,6 @@ internal class FileStructure private constructor(
|
|||||||
target = firFile.annotationsContainer,
|
target = firFile.annotationsContainer,
|
||||||
scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(),
|
scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(),
|
||||||
FirResolvePhase.BODY_RESOLVE,
|
FirResolvePhase.BODY_RESOLVE,
|
||||||
checkPCE = true
|
|
||||||
)
|
)
|
||||||
|
|
||||||
RootStructureElement(firFile, container, moduleComponents)
|
RootStructureElement(firFile, container, moduleComponents)
|
||||||
|
|||||||
+24
-37
@@ -72,21 +72,19 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
toPhase: FirResolvePhase,
|
toPhase: FirResolvePhase,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
collector: FirTowerDataContextCollector? = null,
|
collector: FirTowerDataContextCollector? = null,
|
||||||
checkPCE: Boolean = false,
|
|
||||||
) {
|
) {
|
||||||
val fromPhase = firFile.resolvePhase
|
val fromPhase = firFile.resolvePhase
|
||||||
try {
|
try {
|
||||||
if (toPhase == FirResolvePhase.RAW_FIR) return
|
if (toPhase == FirResolvePhase.RAW_FIR) return
|
||||||
resolveFileToImports(firFile, checkPCE)
|
resolveFileToImports(firFile)
|
||||||
if (toPhase == FirResolvePhase.IMPORTS) return
|
if (toPhase == FirResolvePhase.IMPORTS) return
|
||||||
if (firFile.resolvePhase >= toPhase) return
|
if (firFile.resolvePhase >= toPhase) return
|
||||||
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(firFile, checkPCE) {
|
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(firFile) {
|
||||||
lazyResolveFileDeclarationWithoutLock(
|
lazyResolveFileDeclarationWithoutLock(
|
||||||
firFile = firFile,
|
firFile = firFile,
|
||||||
toPhase = toPhase,
|
toPhase = toPhase,
|
||||||
collector = collector,
|
collector = collector,
|
||||||
scopeSession = scopeSession,
|
scopeSession = scopeSession,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
@@ -94,16 +92,16 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveFileToImports(firFile: FirFile, checkPCE: Boolean) {
|
private fun resolveFileToImports(firFile: FirFile) {
|
||||||
if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return
|
if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return
|
||||||
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(firFile, checkPCE) {
|
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(firFile) {
|
||||||
resolveFileToImportsWithoutLock(firFile, checkPCE)
|
resolveFileToImportsWithoutLock(firFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveFileToImportsWithoutLock(firFile: FirFile, checkPCE: Boolean) {
|
private fun resolveFileToImportsWithoutLock(firFile: FirFile) {
|
||||||
if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return
|
if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
firFile.transform<FirElement, Any?>(FirImportResolveTransformer(firFile.moduleData.session), null)
|
firFile.transform<FirElement, Any?>(FirImportResolveTransformer(firFile.moduleData.session), null)
|
||||||
firFile.replaceResolvePhase(FirResolvePhase.IMPORTS)
|
firFile.replaceResolvePhase(FirResolvePhase.IMPORTS)
|
||||||
|
|
||||||
@@ -113,13 +111,12 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
firFile: FirFile,
|
firFile: FirFile,
|
||||||
toPhase: FirResolvePhase,
|
toPhase: FirResolvePhase,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
checkPCE: Boolean = false,
|
|
||||||
collector: FirTowerDataContextCollector? = null,
|
collector: FirTowerDataContextCollector? = null,
|
||||||
) {
|
) {
|
||||||
if (toPhase == FirResolvePhase.RAW_FIR) return
|
if (toPhase == FirResolvePhase.RAW_FIR) return
|
||||||
resolveFileToImportsWithoutLock(firFile, checkPCE)
|
resolveFileToImportsWithoutLock(firFile)
|
||||||
if (toPhase == FirResolvePhase.IMPORTS) return
|
if (toPhase == FirResolvePhase.IMPORTS) return
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
|
|
||||||
val validForResolveDeclarations = buildList {
|
val validForResolveDeclarations = buildList {
|
||||||
add(firFile.annotationsContainer)
|
add(firFile.annotationsContainer)
|
||||||
@@ -135,7 +132,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
var currentPhase = FirResolvePhase.IMPORTS
|
var currentPhase = FirResolvePhase.IMPORTS
|
||||||
while (currentPhase < toPhase) {
|
while (currentPhase < toPhase) {
|
||||||
currentPhase = currentPhase.next
|
currentPhase = currentPhase.next
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
|
|
||||||
val transformersToApply = designations.filter { designation ->
|
val transformersToApply = designations.filter { designation ->
|
||||||
designation.target.resolvePhase < currentPhase
|
designation.target.resolvePhase < currentPhase
|
||||||
@@ -145,6 +142,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
|
|
||||||
moduleComponents.globalResolveComponents.phaseRunner.runPhaseWithCustomResolve(currentPhase) {
|
moduleComponents.globalResolveComponents.phaseRunner.runPhaseWithCustomResolve(currentPhase) {
|
||||||
for (curDesignation in transformersToApply) {
|
for (curDesignation in transformersToApply) {
|
||||||
|
checkCanceled()
|
||||||
LLFirLazyTransformerExecutor.execute(
|
LLFirLazyTransformerExecutor.execute(
|
||||||
phase = currentPhase,
|
phase = currentPhase,
|
||||||
designation = curDesignation,
|
designation = curDesignation,
|
||||||
@@ -153,7 +151,6 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
||||||
towerDataContextCollector = collector,
|
towerDataContextCollector = collector,
|
||||||
firProviderInterceptor = null,
|
firProviderInterceptor = null,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,10 +158,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fastTrackForImportsPhase(
|
private fun fastTrackForImportsPhase(target: FirElementWithResolvePhase): Boolean {
|
||||||
target: FirElementWithResolvePhase,
|
|
||||||
checkPCE: Boolean,
|
|
||||||
): Boolean {
|
|
||||||
val provider = target.moduleData.session.firProvider
|
val provider = target.moduleData.session.firProvider
|
||||||
val firFile = when (target) {
|
val firFile = when (target) {
|
||||||
is FirFile -> target
|
is FirFile -> target
|
||||||
@@ -172,7 +166,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
is FirClassLikeDeclaration -> provider.getFirClassifierContainerFile(target.symbol)
|
is FirClassLikeDeclaration -> provider.getFirClassifierContainerFile(target.symbol)
|
||||||
else -> null
|
else -> null
|
||||||
} ?: return false
|
} ?: return false
|
||||||
resolveFileToImports(firFile, checkPCE)
|
resolveFileToImports(firFile)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,11 +180,10 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
target: FirElementWithResolvePhase,
|
target: FirElementWithResolvePhase,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
toPhase: FirResolvePhase,
|
toPhase: FirResolvePhase,
|
||||||
checkPCE: Boolean,
|
|
||||||
) {
|
) {
|
||||||
val fromPhase = target.resolvePhase
|
val fromPhase = target.resolvePhase
|
||||||
try {
|
try {
|
||||||
doLazyResolve(target, scopeSession, toPhase, checkPCE)
|
doLazyResolve(target, scopeSession, toPhase)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
handleExceptionFromResolve(e, moduleComponents.sessionInvalidator, target, fromPhase, toPhase)
|
handleExceptionFromResolve(e, moduleComponents.sessionInvalidator, target, fromPhase, toPhase)
|
||||||
}
|
}
|
||||||
@@ -200,27 +193,26 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
target: FirElementWithResolvePhase,
|
target: FirElementWithResolvePhase,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
toPhase: FirResolvePhase,
|
toPhase: FirResolvePhase,
|
||||||
checkPCE: Boolean,
|
|
||||||
) {
|
) {
|
||||||
if (toPhase == FirResolvePhase.RAW_FIR) return
|
if (toPhase == FirResolvePhase.RAW_FIR) return
|
||||||
if (toPhase == FirResolvePhase.IMPORTS) {
|
if (toPhase == FirResolvePhase.IMPORTS) {
|
||||||
if (fastTrackForImportsPhase(target, checkPCE)) {
|
if (fastTrackForImportsPhase(target)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (target) {
|
when (target) {
|
||||||
is FirSyntheticPropertyAccessor -> {
|
is FirSyntheticPropertyAccessor -> {
|
||||||
lazyResolve(target.delegate, scopeSession, toPhase, checkPCE,)
|
lazyResolve(target.delegate, scopeSession, toPhase)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
is FirBackingField -> {
|
is FirBackingField -> {
|
||||||
lazyResolve(target.propertySymbol.fir, scopeSession, toPhase, checkPCE,)
|
lazyResolve(target.propertySymbol.fir, scopeSession, toPhase)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
is FirFile -> {
|
is FirFile -> {
|
||||||
lazyResolveFileDeclaration(target, toPhase, scopeSession, checkPCE = checkPCE)
|
lazyResolveFileDeclaration(target, toPhase, scopeSession)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
else -> {}
|
else -> {}
|
||||||
@@ -273,16 +265,15 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
if (designation.target.resolvePhase >= neededPhase) return
|
if (designation.target.resolvePhase >= neededPhase) return
|
||||||
|
|
||||||
if (neededPhase == FirResolvePhase.IMPORTS) {
|
if (neededPhase == FirResolvePhase.IMPORTS) {
|
||||||
resolveFileToImports(designation.firFile, checkPCE)
|
resolveFileToImports(designation.firFile)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(designation.firFile, checkPCE) {
|
moduleComponents.globalResolveComponents.lockProvider.runCustomResolveUnderLock(designation.firFile) {
|
||||||
runLazyDesignatedResolveWithoutLock(
|
runLazyDesignatedResolveWithoutLock(
|
||||||
designation = designation,
|
designation = designation,
|
||||||
scopeSession = scopeSession,
|
scopeSession = scopeSession,
|
||||||
toPhase = neededPhase,
|
toPhase = neededPhase,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
designation.target
|
designation.target
|
||||||
}
|
}
|
||||||
@@ -293,10 +284,9 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
designation: FirDesignationWithFile,
|
designation: FirDesignationWithFile,
|
||||||
scopeSession: ScopeSession,
|
scopeSession: ScopeSession,
|
||||||
toPhase: FirResolvePhase,
|
toPhase: FirResolvePhase,
|
||||||
checkPCE: Boolean,
|
|
||||||
) {
|
) {
|
||||||
if (toPhase == FirResolvePhase.RAW_FIR) return
|
if (toPhase == FirResolvePhase.RAW_FIR) return
|
||||||
resolveFileToImportsWithoutLock(designation.firFile, checkPCE)
|
resolveFileToImportsWithoutLock(designation.firFile)
|
||||||
if (toPhase == FirResolvePhase.IMPORTS) return
|
if (toPhase == FirResolvePhase.IMPORTS) return
|
||||||
|
|
||||||
val declarationResolvePhase = designation.target.resolvePhase
|
val declarationResolvePhase = designation.target.resolvePhase
|
||||||
@@ -306,7 +296,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
|
|
||||||
while (currentPhase < toPhase) {
|
while (currentPhase < toPhase) {
|
||||||
currentPhase = currentPhase.next
|
currentPhase = currentPhase.next
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
|
|
||||||
LLFirLazyTransformerExecutor.execute(
|
LLFirLazyTransformerExecutor.execute(
|
||||||
phase = currentPhase,
|
phase = currentPhase,
|
||||||
@@ -316,18 +306,16 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
||||||
towerDataContextCollector = null,
|
towerDataContextCollector = null,
|
||||||
firProviderInterceptor = null,
|
firProviderInterceptor = null,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
internal fun runLazyDesignatedOnAirResolveToBodyWithoutLock(
|
||||||
designation: FirDesignationWithFile,
|
designation: FirDesignationWithFile,
|
||||||
checkPCE: Boolean,
|
|
||||||
onAirCreatedDeclaration: Boolean,
|
onAirCreatedDeclaration: Boolean,
|
||||||
towerDataContextCollector: FirTowerDataContextCollector?,
|
towerDataContextCollector: FirTowerDataContextCollector?,
|
||||||
) {
|
) {
|
||||||
resolveFileToImportsWithoutLock(designation.firFile, checkPCE)
|
resolveFileToImportsWithoutLock(designation.firFile)
|
||||||
var currentPhase = maxOf(designation.target.resolvePhase, FirResolvePhase.IMPORTS)
|
var currentPhase = maxOf(designation.target.resolvePhase, FirResolvePhase.IMPORTS)
|
||||||
|
|
||||||
val scopeSession = ScopeSession()
|
val scopeSession = ScopeSession()
|
||||||
@@ -342,7 +330,7 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
|
|
||||||
while (currentPhase < FirResolvePhase.BODY_RESOLVE) {
|
while (currentPhase < FirResolvePhase.BODY_RESOLVE) {
|
||||||
currentPhase = currentPhase.next
|
currentPhase = currentPhase.next
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
|
|
||||||
LLFirLazyTransformerExecutor.execute(
|
LLFirLazyTransformerExecutor.execute(
|
||||||
phase = currentPhase,
|
phase = currentPhase,
|
||||||
@@ -352,7 +340,6 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod
|
|||||||
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
lockProvider = moduleComponents.globalResolveComponents.lockProvider,
|
||||||
towerDataContextCollector = towerDataContextCollector,
|
towerDataContextCollector = towerDataContextCollector,
|
||||||
firProviderInterceptor = firProviderInterceptor,
|
firProviderInterceptor = firProviderInterceptor,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -35,7 +35,6 @@ internal class LLFirDesignatedSupertypeResolverTransformer(
|
|||||||
private val scopeSession: ScopeSession,
|
private val scopeSession: ScopeSession,
|
||||||
private val lockProvider: LLFirLockProvider,
|
private val lockProvider: LLFirLockProvider,
|
||||||
private val firProviderInterceptor: FirProviderInterceptor?,
|
private val firProviderInterceptor: FirProviderInterceptor?,
|
||||||
private val checkPCE: Boolean,
|
|
||||||
) : LLFirLazyTransformer {
|
) : LLFirLazyTransformer {
|
||||||
|
|
||||||
private val supertypeComputationSession = SupertypeComputationSession()
|
private val supertypeComputationSession = SupertypeComputationSession()
|
||||||
@@ -78,10 +77,10 @@ internal class LLFirDesignatedSupertypeResolverTransformer(
|
|||||||
toVisit.add(designation)
|
toVisit.add(designation)
|
||||||
while (toVisit.isNotEmpty()) {
|
while (toVisit.isNotEmpty()) {
|
||||||
for (nowVisit in toVisit) {
|
for (nowVisit in toVisit) {
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
val resolver = DesignatedFirSupertypeResolverVisitor(nowVisit)
|
val resolver = DesignatedFirSupertypeResolverVisitor(nowVisit)
|
||||||
nowVisit.firFile.lazyResolveToPhase(FirResolvePhase.IMPORTS)
|
nowVisit.firFile.lazyResolveToPhase(FirResolvePhase.IMPORTS)
|
||||||
lockProvider.runCustomResolveUnderLock(nowVisit.firFile, checkPCE) {
|
lockProvider.runCustomResolveUnderLock(nowVisit.firFile) {
|
||||||
nowVisit.firFile.accept(resolver, null)
|
nowVisit.firFile.accept(resolver, null)
|
||||||
}
|
}
|
||||||
resolver.declarationTransformer.ensureDesignationPassed()
|
resolver.declarationTransformer.ensureDesignationPassed()
|
||||||
@@ -108,7 +107,7 @@ internal class LLFirDesignatedSupertypeResolverTransformer(
|
|||||||
private fun apply(visited: Collection<FirDesignationWithFile>) {
|
private fun apply(visited: Collection<FirDesignationWithFile>) {
|
||||||
fun applyToFileSymbols(designations: List<FirDesignationWithFile>) {
|
fun applyToFileSymbols(designations: List<FirDesignationWithFile>) {
|
||||||
for (designation in designations) {
|
for (designation in designations) {
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
val applier = DesignatedFirApplySupertypesTransformer(designation)
|
val applier = DesignatedFirApplySupertypesTransformer(designation)
|
||||||
designation.firFile.transform<FirElement, Void?>(applier, null)
|
designation.firFile.transform<FirElement, Void?>(applier, null)
|
||||||
applier.declarationTransformer.ensureDesignationPassed()
|
applier.declarationTransformer.ensureDesignationPassed()
|
||||||
@@ -117,8 +116,8 @@ internal class LLFirDesignatedSupertypeResolverTransformer(
|
|||||||
|
|
||||||
val filesToDesignations = visited.groupBy { it.firFile }
|
val filesToDesignations = visited.groupBy { it.firFile }
|
||||||
for (designationsPerFile in filesToDesignations) {
|
for (designationsPerFile in filesToDesignations) {
|
||||||
if (checkPCE) checkCanceled()
|
checkCanceled()
|
||||||
lockProvider.runCustomResolveUnderLock(designationsPerFile.key, checkPCE) {
|
lockProvider.runCustomResolveUnderLock(designationsPerFile.key) {
|
||||||
val session = designationsPerFile.key.llFirResolvableSession
|
val session = designationsPerFile.key.llFirResolvableSession
|
||||||
?: error("When FirFile exists for the declaration, the session should be resolvevablable")
|
?: error("When FirFile exists for the declaration, the session should be resolvevablable")
|
||||||
session.moduleComponents.sessionInvalidator.withInvalidationOnException(session) {
|
session.moduleComponents.sessionInvalidator.withInvalidationOnException(session) {
|
||||||
|
|||||||
-2
@@ -23,7 +23,6 @@ internal class LLFirLazyTransformerExecutor {
|
|||||||
lockProvider: LLFirLockProvider,
|
lockProvider: LLFirLockProvider,
|
||||||
towerDataContextCollector: FirTowerDataContextCollector?,
|
towerDataContextCollector: FirTowerDataContextCollector?,
|
||||||
firProviderInterceptor: FirProviderInterceptor?,
|
firProviderInterceptor: FirProviderInterceptor?,
|
||||||
checkPCE: Boolean
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
val lazyTransformer = LazyTransformerFactory.createLazyTransformer(
|
val lazyTransformer = LazyTransformerFactory.createLazyTransformer(
|
||||||
@@ -33,7 +32,6 @@ internal class LLFirLazyTransformerExecutor {
|
|||||||
lockProvider,
|
lockProvider,
|
||||||
towerDataContextCollector,
|
towerDataContextCollector,
|
||||||
firProviderInterceptor,
|
firProviderInterceptor,
|
||||||
checkPCE
|
|
||||||
)
|
)
|
||||||
lazyTransformer.transformDeclaration(phaseRunner)
|
lazyTransformer.transformDeclaration(phaseRunner)
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -20,7 +20,6 @@ internal object LazyTransformerFactory {
|
|||||||
lockProvider: LLFirLockProvider,
|
lockProvider: LLFirLockProvider,
|
||||||
towerDataContextCollector: FirTowerDataContextCollector?,
|
towerDataContextCollector: FirTowerDataContextCollector?,
|
||||||
firProviderInterceptor: FirProviderInterceptor?,
|
firProviderInterceptor: FirProviderInterceptor?,
|
||||||
checkPCE: Boolean,
|
|
||||||
): LLFirLazyTransformer = when (phase) {
|
): LLFirLazyTransformer = when (phase) {
|
||||||
FirResolvePhase.COMPANION_GENERATION -> LLFirDesignatedGeneratedCompanionObjectResolveTransformer(
|
FirResolvePhase.COMPANION_GENERATION -> LLFirDesignatedGeneratedCompanionObjectResolveTransformer(
|
||||||
designation = designation,
|
designation = designation,
|
||||||
@@ -33,7 +32,6 @@ internal object LazyTransformerFactory {
|
|||||||
scopeSession = scopeSession,
|
scopeSession = scopeSession,
|
||||||
lockProvider = lockProvider,
|
lockProvider = lockProvider,
|
||||||
firProviderInterceptor = firProviderInterceptor,
|
firProviderInterceptor = firProviderInterceptor,
|
||||||
checkPCE = checkPCE,
|
|
||||||
)
|
)
|
||||||
FirResolvePhase.TYPES -> LLFirDesignatedTypeResolverTransformer(
|
FirResolvePhase.TYPES -> LLFirDesignatedTypeResolverTransformer(
|
||||||
designation,
|
designation,
|
||||||
|
|||||||
Reference in New Issue
Block a user