File tree Expand file tree Collapse file tree
bundle/src/test/java/dev/cel/bundle
runtime/src/main/java/dev/cel/runtime/planner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1982,10 +1982,13 @@ public void program_nativeTypeUnknownsEnabled_asCallArguments() throws Exception
19821982
19831983 @ Test
19841984 public void program_comprehensionDisabled_throws () throws Exception {
1985- // TODO: Planner ExecutionFrame ignores CelOptions.enableComprehension(false).
19861985 Cel cel =
1987- legacyCelBuilderWithMacros ()
1988- .setOptions (CelOptions .current ().enableComprehension (false ).build ())
1986+ plannerCelBuilderWithMacros ()
1987+ .setOptions (
1988+ CelOptions .current ()
1989+ .enableHeterogeneousNumericComparisons (true )
1990+ .enableComprehension (false )
1991+ .build ())
19891992 .build ();
19901993 CelAbstractSyntaxTree ast = cel .compile ("['foo', 'bar'].map(x, x)" ).getAst ();
19911994
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ static ExecutionFrame create(
4646 @ Nullable CelEvaluationListener listener ) {
4747 return new ExecutionFrame (
4848 functionResolver ,
49- celOptions . comprehensionMaxIterations ( ),
49+ getComprehensionMaxIterations ( celOptions ),
5050 partialVars ,
5151 listener ,
5252 /* asyncTracker= */ null );
@@ -61,12 +61,16 @@ static ExecutionFrame createForAsync(
6161 checkNotNull (asyncTracker , "asyncTracker" );
6262 return new ExecutionFrame (
6363 functionResolver ,
64- celOptions . comprehensionMaxIterations ( ),
64+ getComprehensionMaxIterations ( celOptions ),
6565 partialVars ,
6666 listener ,
6767 asyncTracker );
6868 }
6969
70+ private static int getComprehensionMaxIterations (CelOptions celOptions ) {
71+ return celOptions .enableComprehension () ? celOptions .comprehensionMaxIterations () : 0 ;
72+ }
73+
7074 Optional <CelResolvedOverload > findOverload (
7175 String functionName , Collection <String > overloadIds , Object [] args )
7276 throws CelEvaluationException {
You can’t perform that action at this time.
0 commit comments