diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperValueSpecificationBuilder.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperValueSpecificationBuilder.java index dc3dcb83ce..277c8eaca8 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperValueSpecificationBuilder.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-compiler/src/main/java/org/finos/legend/engine/language/pure/compiler/toPureGraph/HelperValueSpecificationBuilder.java @@ -15,6 +15,7 @@ package org.finos.legend.engine.language.pure.compiler.toPureGraph; import org.eclipse.collections.api.RichIterable; +import org.eclipse.collections.api.block.function.Function3; import org.eclipse.collections.api.list.ListIterable; import org.eclipse.collections.api.list.MutableList; import org.eclipse.collections.api.tuple.Pair; @@ -96,10 +97,15 @@ public static LambdaFunction buildLambdaWithContext(List buildLambdaWithContext(String lambdaId, List expressions, List parameters, CompileContext context, ProcessingContext ctx) + { + return buildLambdaWithContext(lambdaId, expressions, parameters, context, ctx, ValueSpecificationBuilder::new); + } + + public static LambdaFunction buildLambdaWithContext(String lambdaId, List expressions, List parameters, CompileContext context, ProcessingContext ctx, Function3, ProcessingContext, ValueSpecificationBuilder> valueSpecificationBuilderFactory) { ctx.push("new lambda"); ctx.addVariableLevel(); - MutableList pureParameters = ListIterate.collect(parameters, p -> (VariableExpression) p.accept(new ValueSpecificationBuilder(context, Lists.mutable.empty(), ctx))); + MutableList pureParameters = ListIterate.collect(parameters, p -> (VariableExpression) p.accept(valueSpecificationBuilderFactory.value(context, Lists.mutable.empty(), ctx))); if (parameters.size() != 0 && !parameters.get(0).name.equals("v_automap")) { if (ctx.milestoningDatePropagationContext.size() == 0) @@ -112,7 +118,7 @@ public static LambdaFunction buildLambdaWithContext(String lambdaId, List openVariables = Lists.mutable.empty(); - MutableList valueSpecifications = ListIterate.collect(expressions, p -> p.accept(new ValueSpecificationBuilder(context, openVariables, ctx))); + MutableList valueSpecifications = ListIterate.collect(expressions, p -> p.accept(valueSpecificationBuilderFactory.value(context, openVariables, ctx))); // Remove Lambda parameters from openVariables MutableList cleanedOpenVariables = openVariables.distinct();