[FIR/IR generator] Extract visitFunctionName to AbstractElement

This commit is contained in:
Sergej Jaskiewicz
2023-11-13 18:31:37 +01:00
committed by Space Team
parent 8ba42a7ff2
commit 9a11208e67
5 changed files with 25 additions and 26 deletions
@@ -8,12 +8,12 @@ package org.jetbrains.kotlin.generators.tree
/**
* A class representing a FIR or IR tree element.
*/
abstract class AbstractElement<Element, Field> : ElementOrRef<Element, Field>, FieldContainer, ImplementationKindOwner
abstract class AbstractElement<Element, Field>(
val name: String,
) : ElementOrRef<Element, Field>, FieldContainer, ImplementationKindOwner
where Element : AbstractElement<Element, Field>,
Field : AbstractField {
abstract val name: String
/**
* The fully-qualified name of the property in the tree generator that is used to configure this element.
*/
@@ -38,10 +38,18 @@ abstract class AbstractElement<Element, Field> : ElementOrRef<Element, Field>, F
open val isSealed: Boolean
get() = false
/**
* The value of this property will be used to name a `visit*` method for this element in visitor classes.
*
* In `visit*`, the `*` will be replaced with the value of this property.
*/
var nameInVisitorMethod: String = name
/**
* The name of the method in visitors used to visit this element.
*/
abstract val visitFunctionName: String
val visitFunctionName: String
get() = "visit$nameInVisitorMethod"
/**
* The name of the parameter representing this element in the visitor method used to visit this element.