[FIR/IR generator] Factor out walkableChildren and transformableChildren
This commit is contained in:
committed by
Space Team
parent
13ae129505
commit
c6eb7d6c21
-4
@@ -80,10 +80,6 @@ abstract class AbstractElement<Element, Field>(
|
||||
|
||||
abstract override val allFields: List<Field>
|
||||
|
||||
abstract override val walkableChildren: List<Field>
|
||||
|
||||
abstract override val transformableChildren: List<Field>
|
||||
|
||||
/**
|
||||
* A custom return type of the corresponding transformer method for this element.
|
||||
*/
|
||||
|
||||
+7
@@ -51,6 +51,13 @@ abstract class AbstractField {
|
||||
*/
|
||||
var useInBaseTransformerDetection = true
|
||||
|
||||
/**
|
||||
* Whether a visitor should be run on this field in the generated `acceptChildren` in `transformChildren` method.
|
||||
*
|
||||
* Only has effect if [containsElement] is `true`.
|
||||
*/
|
||||
var needAcceptAndTransform: Boolean = true
|
||||
|
||||
override fun toString(): String {
|
||||
return name
|
||||
}
|
||||
|
||||
+8
-2
@@ -21,9 +21,15 @@ interface FieldContainer {
|
||||
val hasTransformChildrenMethod: Boolean
|
||||
get() = false
|
||||
|
||||
/**
|
||||
* The fields on which to run the visitor in generated `acceptChildren` methods.
|
||||
*/
|
||||
val walkableChildren: List<AbstractField>
|
||||
get() = emptyList()
|
||||
get() = allFields.filter { it.containsElement && !it.withGetter && it.needAcceptAndTransform }
|
||||
|
||||
/**
|
||||
* The fields on which to run the transformer in generated `transformChildren` methods.
|
||||
*/
|
||||
val transformableChildren: List<AbstractField>
|
||||
get() = emptyList()
|
||||
get() = walkableChildren.filter { it.isMutable || it is ListField }
|
||||
}
|
||||
Reference in New Issue
Block a user