[LL FIR] cache import scopes during compiler required annotations phase
In LL FIR file is always already resolved to import phase, so we can cache the result ^KT-56551
This commit is contained in:
committed by
Space Team
parent
dabc4e34ff
commit
72f30d78d6
+2
@@ -85,6 +85,8 @@ private class LLFirCompilerRequiredAnnotationsTargetResolver(
|
|||||||
|
|
||||||
resolver.resolveDesignation()
|
resolver.resolveDesignation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val useCacheForImportScope: Boolean get() = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private val transformer = FirCompilerRequiredAnnotationsResolveTransformer(
|
private val transformer = FirCompilerRequiredAnnotationsResolveTransformer(
|
||||||
|
|||||||
+1
-1
@@ -391,7 +391,7 @@ abstract class AbstractFirSpecificAnnotationResolveTransformer(
|
|||||||
lateinit var scopes: List<FirScope>
|
lateinit var scopes: List<FirScope>
|
||||||
|
|
||||||
inline fun <T> withFileScopes(file: FirFile, f: () -> T): T {
|
inline fun <T> withFileScopes(file: FirFile, f: () -> T): T {
|
||||||
scopes = createImportingScopes(file, session, scopeSession, useCaching = false)
|
scopes = createImportingScopes(file, session, scopeSession, useCaching = computationSession.useCacheForImportScope)
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -136,6 +136,8 @@ open class CompilerRequiredAnnotationsComputationSession {
|
|||||||
return file in filesWithResolvedImports
|
return file in filesWithResolvedImports
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open val useCacheForImportScope: Boolean get() = false
|
||||||
|
|
||||||
fun recordThatImportsAreResolved(file: FirFile) {
|
fun recordThatImportsAreResolved(file: FirFile) {
|
||||||
if (!filesWithResolvedImports.add(file)) {
|
if (!filesWithResolvedImports.add(file)) {
|
||||||
error("Imports are resolved twice")
|
error("Imports are resolved twice")
|
||||||
|
|||||||
Reference in New Issue
Block a user