(meh cel.MacroExprFactory, target ast.Expr, args []ast.Expr)
| 614 | } |
| 615 | |
| 616 | func mathLeast(meh cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
| 617 | if !macroTargetMatchesNamespace(mathNamespace, target) { |
| 618 | return nil, nil |
| 619 | } |
| 620 | switch len(args) { |
| 621 | case 0: |
| 622 | return nil, meh.NewError(target.ID(), "math.least() requires at least one argument") |
| 623 | case 1: |
| 624 | if isListLiteralWithNumericArgs(args[0]) || isNumericArgType(args[0]) { |
| 625 | return meh.NewCall(minFunc, args[0]), nil |
| 626 | } |
| 627 | return nil, meh.NewError(args[0].ID(), "math.least() invalid single argument value") |
| 628 | case 2: |
| 629 | err := checkInvalidArgs(meh, "math.least()", args) |
| 630 | if err != nil { |
| 631 | return nil, err |
| 632 | } |
| 633 | return meh.NewCall(minFunc, args...), nil |
| 634 | default: |
| 635 | err := checkInvalidArgs(meh, "math.least()", args) |
| 636 | if err != nil { |
| 637 | return nil, err |
| 638 | } |
| 639 | return meh.NewCall(minFunc, meh.NewList(args...)), nil |
| 640 | } |
| 641 | } |
| 642 | |
| 643 | func mathGreatest(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
| 644 | if !macroTargetMatchesNamespace(mathNamespace, target) { |
nothing calls this directly
no test coverage detected