[FIR] Make diagnostics collectors returns List instead of Iterable

This commit is contained in:
Dmitriy Novozhilov
2020-11-03 16:01:13 +03:00
parent 20453bf0d8
commit dabc259ae8
4 changed files with 5 additions and 5 deletions
@@ -33,7 +33,7 @@ abstract class AbstractDiagnosticCollector(
override val scopeSession: ScopeSession = ScopeSession(), override val scopeSession: ScopeSession = ScopeSession(),
returnTypeCalculator: ReturnTypeCalculator = ReturnTypeCalculatorForFullBodyResolve() returnTypeCalculator: ReturnTypeCalculator = ReturnTypeCalculatorForFullBodyResolve()
) : SessionHolder { ) : SessionHolder {
fun collectDiagnostics(firFile: FirFile): Iterable<FirDiagnostic<*>> { fun collectDiagnostics(firFile: FirFile): List<FirDiagnostic<*>> {
if (!componentsInitialized) { if (!componentsInitialized) {
throw IllegalStateException("Components are not initialized") throw IllegalStateException("Components are not initialized")
} }
@@ -43,7 +43,7 @@ abstract class AbstractDiagnosticCollector(
} }
protected abstract fun initializeCollector() protected abstract fun initializeCollector()
protected abstract fun getCollectedDiagnostics(): Iterable<FirDiagnostic<*>> protected abstract fun getCollectedDiagnostics(): List<FirDiagnostic<*>>
abstract val reporter: DiagnosticReporter abstract val reporter: DiagnosticReporter
private val components: MutableList<AbstractDiagnosticCollectorComponent> = mutableListOf() private val components: MutableList<AbstractDiagnosticCollectorComponent> = mutableListOf()
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.collectors
import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.FirSession
object FirDiagnosticsCollector { object FirDiagnosticsCollector {
fun create(session: FirSession): AbstractDiagnosticCollector { fun create(session: FirSession): SimpleDiagnosticsCollector {
val collector = SimpleDiagnosticsCollector(session) val collector = SimpleDiagnosticsCollector(session)
collector.registerAllComponents() collector.registerAllComponents()
return collector return collector
@@ -17,7 +17,7 @@ class SimpleDiagnosticsCollector(session: FirSession) : AbstractDiagnosticCollec
reporter = SimpleDiagnosticReporter() reporter = SimpleDiagnosticReporter()
} }
override fun getCollectedDiagnostics(): Iterable<FirDiagnostic<*>> { override fun getCollectedDiagnostics(): List<FirDiagnostic<*>> {
return reporter.diagnostics return reporter.diagnostics
} }
} }
@@ -56,7 +56,7 @@ internal abstract class AbstractFirIdeDiagnosticsCollector(
checkCanceled() checkCanceled()
} }
override fun getCollectedDiagnostics(): Iterable<FirDiagnostic<*>> { override fun getCollectedDiagnostics(): List<FirDiagnostic<*>> {
// Not necessary in IDE // Not necessary in IDE
return emptyList() return emptyList()
} }