[FIR] Part 2. Setup running platform checkers in tests
^KT-58881
This commit is contained in:
committed by
Nikolay Lunyak
parent
727d2f46f8
commit
c4e4776c5e
@@ -7,8 +7,6 @@ package org.jetbrains.kotlin.fir
|
||||
|
||||
import org.jetbrains.kotlin.KtSourceFile
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporterFactory
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.fir.declarations.FirFile
|
||||
import org.jetbrains.kotlin.fir.pipeline.*
|
||||
import org.jetbrains.kotlin.fir.resolve.ScopeSession
|
||||
@@ -19,8 +17,6 @@ abstract class AbstractFirAnalyzerFacade {
|
||||
abstract val scopeSession: ScopeSession
|
||||
abstract val result: FirResult
|
||||
|
||||
abstract fun runCheckers(): Map<FirFile, List<KtDiagnostic>>
|
||||
|
||||
abstract fun runResolution(): List<FirFile>
|
||||
}
|
||||
|
||||
@@ -39,8 +35,6 @@ class FirAnalyzerFacade(
|
||||
override val result: FirResult
|
||||
get() = FirResult(listOf(ModuleCompilerAnalyzedOutput(session, scopeSession, firFiles!!)))
|
||||
|
||||
private var collectedDiagnostics: Map<FirFile, List<KtDiagnostic>>? = null
|
||||
|
||||
private fun buildRawFir() {
|
||||
if (firFiles != null) return
|
||||
firFiles = when (parser) {
|
||||
@@ -55,11 +49,4 @@ class FirAnalyzerFacade(
|
||||
_scopeSession = session.runResolution(firFiles!!).first
|
||||
return firFiles!!
|
||||
}
|
||||
|
||||
override fun runCheckers(): Map<FirFile, List<KtDiagnostic>> {
|
||||
if (_scopeSession == null) runResolution()
|
||||
if (collectedDiagnostics != null) return collectedDiagnostics!!
|
||||
collectedDiagnostics = session.runCheckers(scopeSession, firFiles!!, DiagnosticReporterFactory.createPendingReporter())
|
||||
return collectedDiagnostics!!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user