diff --git a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/config/AbstractBuilderConfigurator.kt b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/config/AbstractBuilderConfigurator.kt index 2469637d6e9..02874dd3f68 100644 --- a/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/config/AbstractBuilderConfigurator.kt +++ b/generators/tree-generator-common/src/org/jetbrains/kotlin/generators/tree/config/AbstractBuilderConfigurator.kt @@ -127,6 +127,9 @@ abstract class AbstractBuilderConfigurator> + get() = elements.flatMap { it.allImplementations }.mapNotNull { it.builder } + /** * Allows to batch-apply [config] to certain fields in _all_ the builders that satisfy the given * [builderPredicate]. @@ -143,8 +146,7 @@ abstract class AbstractBuilderConfigurator Boolean)? = null, config: LeafBuilderConfigurationContext.(field: String) -> Unit ) { - val builders = elements.flatMap { it.allImplementations }.mapNotNull { it.builder } - for (builder in builders) { + for (builder in allLeafBuilders) { if (builderPredicate != null && !builderPredicate(builder)) continue if (!builder.allFields.any { it.name == field }) continue if (fieldPredicate != null && !fieldPredicate(builder[field])) continue @@ -152,6 +154,17 @@ abstract class AbstractBuilderConfigurator Unit) { + for (builder in allLeafBuilders) { + LeafBuilderConfigurationContext(builder).config() + } + } + /** * A DSL for configuring one or more intermediate or leaf builder classes. */