FIR: rename goToNestedDeclarations -> visitNestedElements

This commit is contained in:
Ilya Kirillov
2021-04-16 18:04:41 +02:00
parent eed143d17b
commit ea233cddf8
4 changed files with 12 additions and 12 deletions
@@ -32,7 +32,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
protected open fun shouldVisitDeclaration(declaration: FirDeclaration) = true protected open fun shouldVisitDeclaration(declaration: FirDeclaration) = true
protected open fun onDeclarationExit(declaration: FirDeclaration) {} protected open fun onDeclarationExit(declaration: FirDeclaration) {}
protected abstract fun goToNestedDeclarations(element: FirElement) protected abstract fun visitNestedElements(element: FirElement)
protected abstract fun runComponents(element: FirElement) protected abstract fun runComponents(element: FirElement)
override fun visitElement(element: FirElement, data: Nothing?) { override fun visitElement(element: FirElement, data: Nothing?) {
@@ -41,13 +41,13 @@ abstract class AbstractDiagnosticCollectorVisitor(
return return
} }
runComponents(element) runComponents(element)
goToNestedDeclarations(element) visitNestedElements(element)
} }
override fun visitAnnotationContainer(annotationContainer: FirAnnotationContainer, data: Nothing?) { override fun visitAnnotationContainer(annotationContainer: FirAnnotationContainer, data: Nothing?) {
withSuppressedDiagnostics(annotationContainer) { withSuppressedDiagnostics(annotationContainer) {
runComponents(annotationContainer) runComponents(annotationContainer)
goToNestedDeclarations(annotationContainer) visitNestedElements(annotationContainer)
} }
} }
@@ -161,7 +161,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
if (typeRef.source != null && typeRef.source?.kind !is FirFakeSourceElementKind) { if (typeRef.source != null && typeRef.source?.kind !is FirFakeSourceElementKind) {
withSuppressedDiagnostics(typeRef) { withSuppressedDiagnostics(typeRef) {
runComponents(typeRef) runComponents(typeRef)
goToNestedDeclarations(typeRef) visitNestedElements(typeRef)
} }
} }
} }
@@ -185,7 +185,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
protected inline fun visitWithDeclaration( protected inline fun visitWithDeclaration(
declaration: FirDeclaration, declaration: FirDeclaration,
block: () -> Unit = { goToNestedDeclarations(declaration) } block: () -> Unit = { visitNestedElements(declaration) }
) { ) {
if (shouldVisitDeclaration(declaration)) { if (shouldVisitDeclaration(declaration)) {
runComponents(declaration) runComponents(declaration)
@@ -203,7 +203,7 @@ abstract class AbstractDiagnosticCollectorVisitor(
declaration, declaration,
receiverTypeRef?.coneTypeSafe() receiverTypeRef?.coneTypeSafe()
) { ) {
goToNestedDeclarations(declaration) visitNestedElements(declaration)
} }
} }
} }
@@ -211,14 +211,14 @@ abstract class AbstractDiagnosticCollectorVisitor(
private fun visitWithQualifiedAccess(qualifiedAccess: FirQualifiedAccess) { private fun visitWithQualifiedAccess(qualifiedAccess: FirQualifiedAccess) {
return withQualifiedAccess(qualifiedAccess) { return withQualifiedAccess(qualifiedAccess) {
runComponents(qualifiedAccess) runComponents(qualifiedAccess)
goToNestedDeclarations(qualifiedAccess) visitNestedElements(qualifiedAccess)
} }
} }
private fun visitWithGetClassCall(getClassCall: FirGetClassCall) { private fun visitWithGetClassCall(getClassCall: FirGetClassCall) {
return withGetClassCall(getClassCall) { return withGetClassCall(getClassCall) {
runComponents(getClassCall) runComponents(getClassCall)
goToNestedDeclarations(getClassCall) visitNestedElements(getClassCall)
} }
} }
@@ -14,7 +14,7 @@ open class CheckerRunningDiagnosticCollectorVisitor(
components: List<AbstractDiagnosticCollectorComponent> components: List<AbstractDiagnosticCollectorComponent>
) : AbstractDiagnosticCollectorVisitor(context, components) { ) : AbstractDiagnosticCollectorVisitor(context, components) {
override fun goToNestedDeclarations(element: FirElement) { override fun visitNestedElements(element: FirElement) {
element.acceptChildren(this, null) element.acceptChildren(this, null)
} }
@@ -18,11 +18,11 @@ internal open class FirIdeDiagnosticVisitor(
) : CheckerRunningDiagnosticCollectorVisitor(context, components) { ) : CheckerRunningDiagnosticCollectorVisitor(context, components) {
private val beforeElementDiagnosticCollectionHandler = context.session.beforeElementDiagnosticCollectionHandler private val beforeElementDiagnosticCollectionHandler = context.session.beforeElementDiagnosticCollectionHandler
override fun goToNestedDeclarations(element: FirElement) { override fun visitNestedElements(element: FirElement) {
if (element is FirDeclaration) { if (element is FirDeclaration) {
beforeElementDiagnosticCollectionHandler?.beforeGoingNestedDeclaration(element, context) beforeElementDiagnosticCollectionHandler?.beforeGoingNestedDeclaration(element, context)
} }
super.goToNestedDeclarations(element) super.visitNestedElements(element)
} }
override fun runComponents(element: FirElement) { override fun runComponents(element: FirElement) {
@@ -31,7 +31,7 @@ private class ContextCollectingDiagnosticCollectorVisitor private constructor(
} }
} }
override fun goToNestedDeclarations(element: FirElement) { override fun visitNestedElements(element: FirElement) {
if (element is FirDeclaration) { if (element is FirDeclaration) {
contextCollector.nextStep() contextCollector.nextStep()
} else { } else {