FIR CLI: use VFS for LT files loading
may improve performance in some cases and is consistent with handling of PSI files
This commit is contained in:
@@ -107,6 +107,9 @@ open class VfsBasedProjectEnvironment(
|
||||
baseModuleData: FirModuleData,
|
||||
fileSearchScope: AbstractProjectFileSearchScope
|
||||
) = FirJavaFacade(firSession, baseModuleData, project.createJavaClassFinder(fileSearchScope.asPsiSearchScope()))
|
||||
|
||||
override fun getFileText(filePath: String): String? =
|
||||
localFileSystem.findFileByPath(filePath)?.inputStream?.reader(Charsets.UTF_8)?.readText()
|
||||
}
|
||||
|
||||
private fun AbstractProjectFileSearchScope.asPsiSearchScope() =
|
||||
|
||||
@@ -311,8 +311,14 @@ fun compileModuleToAnalyzedFir(
|
||||
val countFilesAndLines = if (performanceManager == null) null else performanceManager::addSourcesStats
|
||||
|
||||
// raw fir
|
||||
val commonRawFir = commonSession?.buildFirViaLightTree(input.commonSources, diagnosticsReporter, countFilesAndLines)
|
||||
val rawFir = session.buildFirViaLightTree(input.platformSources, diagnosticsReporter, countFilesAndLines)
|
||||
val commonRawFir = commonSession?.buildFirViaLightTree(
|
||||
input.commonSources,
|
||||
environment.projectEnvironment,
|
||||
diagnosticsReporter,
|
||||
countFilesAndLines
|
||||
)
|
||||
val rawFir =
|
||||
session.buildFirViaLightTree(input.platformSources, environment.projectEnvironment, diagnosticsReporter, countFilesAndLines)
|
||||
|
||||
// resolution
|
||||
commonSession?.apply {
|
||||
|
||||
Reference in New Issue
Block a user