ProgramOptions implements the Library interface method.
()
| 598 | |
| 599 | // ProgramOptions implements the Library interface method. |
| 600 | func (lib *mathLib) ProgramOptions() []cel.ProgramOption { |
| 601 | var opts []cel.ProgramOption |
| 602 | if lib.version >= 3 { |
| 603 | trackers := []interpreter.CostTrackerOption{ |
| 604 | interpreter.OverloadCostTracker("math_@min_list_double", trackMathListCost), |
| 605 | interpreter.OverloadCostTracker("math_@min_list_int", trackMathListCost), |
| 606 | interpreter.OverloadCostTracker("math_@min_list_uint", trackMathListCost), |
| 607 | interpreter.OverloadCostTracker("math_@max_list_double", trackMathListCost), |
| 608 | interpreter.OverloadCostTracker("math_@max_list_int", trackMathListCost), |
| 609 | interpreter.OverloadCostTracker("math_@max_list_uint", trackMathListCost), |
| 610 | } |
| 611 | opts = append(opts, cel.CostTrackerOptions(trackers...)) |
| 612 | } |
| 613 | return opts |
| 614 | } |
| 615 | |
| 616 | func mathLeast(meh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
| 617 | if !macroTargetMatchesNamespace(mathNamespace, target) { |
nothing calls this directly
no test coverage detected