FIR: remove beforeRunningAllComponentsOnElement/beforeRunningSingleComponentOnElement from AbstractDiagnosticCollectorVisitor

This commit is contained in:
Ilya Kirillov
2021-04-16 18:03:20 +02:00
parent 41e822e8cb
commit eed143d17b
3 changed files with 5 additions and 10 deletions
@@ -29,9 +29,6 @@ abstract class AbstractDiagnosticCollectorVisitor(
protected val components: List<AbstractDiagnosticCollectorComponent>,
) : FirDefaultVisitor<Unit, Nothing?>() {
protected open fun beforeRunningAllComponentsOnElement(element: FirElement) {}
protected open fun beforeRunningSingleComponentOnElement(element: FirElement) {}
protected open fun shouldVisitDeclaration(declaration: FirDeclaration) = true
protected open fun onDeclarationExit(declaration: FirDeclaration) {}
@@ -19,9 +19,7 @@ open class CheckerRunningDiagnosticCollectorVisitor(
}
override fun runComponents(element: FirElement) {
beforeRunningAllComponentsOnElement(element)
components.forEach {
beforeRunningSingleComponentOnElement(element)
element.accept(it, context)
}
}
@@ -18,10 +18,6 @@ internal open class FirIdeDiagnosticVisitor(
) : CheckerRunningDiagnosticCollectorVisitor(context, components) {
private val beforeElementDiagnosticCollectionHandler = context.session.beforeElementDiagnosticCollectionHandler
override fun beforeRunningSingleComponentOnElement(element: FirElement) {
checkCanceled()
}
override fun goToNestedDeclarations(element: FirElement) {
if (element is FirDeclaration) {
beforeElementDiagnosticCollectionHandler?.beforeGoingNestedDeclaration(element, context)
@@ -29,7 +25,11 @@ internal open class FirIdeDiagnosticVisitor(
super.goToNestedDeclarations(element)
}
override fun beforeRunningAllComponentsOnElement(element: FirElement) {
override fun runComponents(element: FirElement) {
beforeElementDiagnosticCollectionHandler?.beforeCollectingForElement(element)
components.forEach {
checkCanceled()
element.accept(it, context)
}
}
}