Evaluate a condition branch only if needed
The CEL language definition suggests:
To get traditional left-to-right short-circuiting evaluation of logical operators, as in C or other languages (also called "McCarthy Evaluation"), the expression e1 && e2 can be rewritten
e1 ? e2 : false. Similarly,e1 || e2can be rewrittene1 ? true : e2.
cel-python used to evaluate the full tree before deciding if a branch will be used or not. This PR only evaluates a branch if selected by the condition.
Fixes https://github.com/cloud-custodian/cel-python/issues/50
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: kapilt / name: Kapil Thangavelu (9c75fd30329fbd9c763d7d129cf285f503772c73)
- :white_check_mark: login: sewi-cpan / name: Sebastian Willing (1d6ce96137fc49fcf18edfceac667517dd833b68)
thanks for the pr, lgtm although a test would be appreciated, would also appreciate a look by @slott56
See https://github.com/cloud-custodian/cel-python/pull/63 which fixes this problem.