Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions bundle/src/test/java/dev/cel/bundle/CelImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1982,10 +1982,13 @@ public void program_nativeTypeUnknownsEnabled_asCallArguments() throws Exception

@Test
public void program_comprehensionDisabled_throws() throws Exception {
// TODO: Planner ExecutionFrame ignores CelOptions.enableComprehension(false).
Cel cel =
legacyCelBuilderWithMacros()
.setOptions(CelOptions.current().enableComprehension(false).build())
plannerCelBuilderWithMacros()
.setOptions(
CelOptions.current()
.enableHeterogeneousNumericComparisons(true)
.enableComprehension(false)
.build())
.build();
CelAbstractSyntaxTree ast = cel.compile("['foo', 'bar'].map(x, x)").getAst();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static ExecutionFrame create(
@Nullable CelEvaluationListener listener) {
return new ExecutionFrame(
functionResolver,
celOptions.comprehensionMaxIterations(),
getComprehensionMaxIterations(celOptions),
partialVars,
listener,
/* asyncTracker= */ null);
Expand All @@ -61,12 +61,16 @@ static ExecutionFrame createForAsync(
checkNotNull(asyncTracker, "asyncTracker");
return new ExecutionFrame(
functionResolver,
celOptions.comprehensionMaxIterations(),
getComprehensionMaxIterations(celOptions),
partialVars,
listener,
asyncTracker);
}

private static int getComprehensionMaxIterations(CelOptions celOptions) {
return celOptions.enableComprehension() ? celOptions.comprehensionMaxIterations() : 0;
}

Optional<CelResolvedOverload> findOverload(
String functionName, Collection<String> overloadIds, Object[] args)
throws CelEvaluationException {
Expand Down
Loading