[LL FIR] support lazy bodies in scripts

Also, it adds guards to avoid problems with PCE

^KT-60728 Fixed
^KT-60519 Fixed
This commit is contained in:
Dmitrii Gridin
2023-07-30 02:57:54 +02:00
committed by Space Team
parent 2f57916869
commit 0e0847bc9d
171 changed files with 5411 additions and 10817 deletions
@@ -95,15 +95,12 @@ internal class KtFirReferenceShortener(
kDocQualifiersToShorten = emptyList(),
)
val towerContext =
if (declarationToVisit !is KtFile || declarationToVisit.isScript()) {
LowLevelFirApiFacadeForResolveOnAir.getOnAirGetTowerContextProvider(firResolveSession, declarationToVisit)
} else {
LowLevelFirApiFacadeForResolveOnAir.getOnAirTowerDataContextProviderForTheWholeFile(
firResolveSession,
declarationToVisit
)
}
val towerContext = if (declarationToVisit is KtFile) {
LowLevelFirApiFacadeForResolveOnAir.getOnAirTowerDataContextProviderForTheWholeFile(firResolveSession, declarationToVisit)
} else {
LowLevelFirApiFacadeForResolveOnAir.getOnAirGetTowerContextProvider(firResolveSession, declarationToVisit)
}
//TODO: collect all usages of available symbols in the file and prevent importing symbols that could introduce name clashes, which
// may alter the meaning of existing code.
val collector = ElementsToShortenCollector(