(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr)
| 370 | } |
| 371 | |
| 372 | func celIndex(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
| 373 | if !isCELNamespace(target) { |
| 374 | return nil, nil |
| 375 | } |
| 376 | index := args[0] |
| 377 | if !isNonNegativeInt(index) { |
| 378 | return index, mef.NewError(index.ID(), "cel.index requires a single non-negative int constant arg") |
| 379 | } |
| 380 | indexVal := index.AsLiteral().(types.Int) |
| 381 | return mef.NewIdent(fmt.Sprintf("@index%d", indexVal)), nil |
| 382 | } |
| 383 | |
| 384 | func celCompreVar(funcName, varPrefix string) cel.MacroFactory { |
| 385 | return func(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) { |
nothing calls this directly
no test coverage detected