@@ -182,55 +182,6 @@ Macro MakeExistsOneMacro2() {
182182 return std::move (*status_or_macro);
183183}
184184
185- absl::optional<Expr> ExpandFilterMacro2 (MacroExprFactory& factory, Expr& target,
186- absl::Span<Expr> args) {
187- if (args.size () != 3 ) {
188- return factory.ReportError (" filter() requires 3 arguments" );
189- }
190- if (!args[0 ].has_ident_expr () || args[0 ].ident_expr ().name ().empty ()) {
191- return factory.ReportErrorAt (
192- args[0 ], " filter() first variable name must be a simple identifier" );
193- }
194- if (!args[1 ].has_ident_expr () || args[1 ].ident_expr ().name ().empty ()) {
195- return factory.ReportErrorAt (
196- args[1 ], " filter() second variable name must be a simple identifier" );
197- }
198- if (args[0 ].ident_expr ().name () == args[1 ].ident_expr ().name ()) {
199- return factory.ReportErrorAt (
200- args[0 ],
201- " filter() second variable must be different from the first variable" );
202- }
203- if (args[0 ].ident_expr ().name () == kAccumulatorVariableName ) {
204- return factory.ReportErrorAt (
205- args[0 ], absl::StrCat (" filter() first variable name cannot be " ,
206- kAccumulatorVariableName ));
207- }
208- if (args[1 ].ident_expr ().name () == kAccumulatorVariableName ) {
209- return factory.ReportErrorAt (
210- args[1 ], absl::StrCat (" filter() second variable name cannot be " ,
211- kAccumulatorVariableName ));
212- }
213- auto name = args[0 ].ident_expr ().name ();
214- auto name2 = args[1 ].ident_expr ().name ();
215- auto init = factory.NewList ();
216- auto condition = factory.NewBoolConst (true );
217- auto step = factory.NewCall (
218- CelOperator::ADD, factory.NewAccuIdent (),
219- factory.NewList (factory.NewListElement (std::move (args[1 ]))));
220- step = factory.NewCall (CelOperator::CONDITIONAL, std::move (args[2 ]),
221- std::move (step), factory.NewAccuIdent ());
222- return factory.NewComprehension (
223- name, name2, std::move (target), factory.AccuVarName (), std::move (init),
224- std::move (condition), std::move (step), factory.NewAccuIdent ());
225- }
226-
227- Macro MakeFilterMacro2 () {
228- auto status_or_macro =
229- Macro::Receiver (CelOperator::FILTER, 3 , ExpandFilterMacro2);
230- ABSL_CHECK_OK (status_or_macro); // Crash OK
231- return std::move (*status_or_macro);
232- }
233-
234185absl::optional<Expr> ExpandTransformList3Macro (MacroExprFactory& factory,
235186 Expr& target,
236187 absl::Span<Expr> args) {
@@ -444,11 +395,6 @@ const Macro& ExistsOneMacro2() {
444395 return *macro;
445396}
446397
447- const Macro& FilterMacro2 () {
448- static const absl::NoDestructor<Macro> macro (MakeFilterMacro2 ());
449- return *macro;
450- }
451-
452398const Macro& TransformList3Macro () {
453399 static const absl::NoDestructor<Macro> macro (MakeTransformList3Macro ());
454400 return *macro;
@@ -477,7 +423,6 @@ absl::Status RegisterComprehensionsV2Macros(MacroRegistry& registry,
477423 CEL_RETURN_IF_ERROR (registry.RegisterMacro (AllMacro2 ()));
478424 CEL_RETURN_IF_ERROR (registry.RegisterMacro (ExistsMacro2 ()));
479425 CEL_RETURN_IF_ERROR (registry.RegisterMacro (ExistsOneMacro2 ()));
480- CEL_RETURN_IF_ERROR (registry.RegisterMacro (FilterMacro2 ()));
481426 CEL_RETURN_IF_ERROR (registry.RegisterMacro (TransformList3Macro ()));
482427 CEL_RETURN_IF_ERROR (registry.RegisterMacro (TransformList4Macro ()));
483428 CEL_RETURN_IF_ERROR (registry.RegisterMacro (TransformMap3Macro ()));
0 commit comments