FIR IDE: add check canceled between diagnostics

This commit is contained in:
Ilya Kirillov
2020-09-15 17:46:48 +03:00
parent 9dd3d8fb14
commit ee794f8664
2 changed files with 7 additions and 0 deletions
@@ -62,9 +62,12 @@ abstract class AbstractDiagnosticCollector(
componentsInitialized = true componentsInitialized = true
} }
protected open fun beforeCollecting() {}
private inner class Visitor : FirDefaultVisitor<Unit, Nothing?>() { private inner class Visitor : FirDefaultVisitor<Unit, Nothing?>() {
private fun <T : FirElement> T.runComponents() { private fun <T : FirElement> T.runComponents() {
components.forEach { components.forEach {
beforeCollecting()
this.accept(it, context) this.accept(it, context)
} }
} }
@@ -48,6 +48,10 @@ internal abstract class AbstractFirIdeDiagnosticsCollector(
reporter = Reporter() reporter = Reporter()
} }
override fun beforeCollecting() {
checkCanceled()
}
override fun getCollectedDiagnostics(): Iterable<FirDiagnostic<*>> { override fun getCollectedDiagnostics(): Iterable<FirDiagnostic<*>> {
// Not necessary in IDE // Not necessary in IDE
return emptyList() return emptyList()