FIR: Share the same ScopeSession instance between phases

^KT-34563 Fixed
This commit is contained in:
Denis Zharkov
2020-01-28 17:36:21 +03:00
parent 280fb94774
commit e725f255f1
8 changed files with 28 additions and 20 deletions
@@ -193,8 +193,10 @@ private fun FirDeclaration.runResolve(
if (designation.all { it.resolvePhase >= toPhase }) {
return
}
val scopeSession = ScopeSession()
val transformer = FirDesignatedBodyResolveTransformerForIDE(
designation.iterator(), state.getSession(psi as KtElement),
scopeSession,
implicitTypeOnly = toPhase == FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE
)
file.transform<FirFile, ResolutionMode>(transformer, ResolutionMode.ContextDependent)
@@ -203,8 +205,8 @@ private fun FirDeclaration.runResolve(
private class FirDesignatedBodyResolveTransformerForIDE(
private val designation: Iterator<FirElement>,
session: FirSession,
scopeSession: ScopeSession = ScopeSession(),
implicitTypeOnly: Boolean = true
scopeSession: ScopeSession,
implicitTypeOnly: Boolean
) : FirBodyResolveTransformer(
session,
phase = FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE,