FIR IDE: add test which check that every declaration is visited single time during diagnostic collection

This commit is contained in:
Ilya Kirillov
2021-02-26 17:51:13 +01:00
parent 0b921ed9d8
commit 70c98d34d2
22 changed files with 353 additions and 10 deletions
@@ -68,13 +68,15 @@ abstract class AbstractDiagnosticCollector(
componentsInitialized = true
}
protected open fun beforeCollecting() {}
protected open fun beforeRunningAllComponentsOnElement(element: FirElement) {}
protected open fun beforeRunningSingleComponentOnElement(element: FirElement) {}
private inner class Visitor : FirDefaultVisitor<Unit, Nothing?>() {
private fun <T : FirElement> T.runComponents() {
if (currentAction.checkInCurrentDeclaration) {
beforeRunningAllComponentsOnElement(this)
components.forEach {
beforeCollecting()
beforeRunningSingleComponentOnElement(this)
this.accept(it, context)
}
}