()
| 86 | } |
| 87 | |
| 88 | func (lib *celBindings) CompileOptions() []cel.EnvOption { |
| 89 | opts := []cel.EnvOption{ |
| 90 | cel.Macros( |
| 91 | // cel.bind(var, <init>, <expr>) |
| 92 | cel.ReceiverMacro(bindMacro, 3, celBind), |
| 93 | ), |
| 94 | } |
| 95 | if lib.version >= 1 { |
| 96 | // The cel.@block signature takes a list of subexpressions and a typed expression which is |
| 97 | // used as the output type. |
| 98 | paramType := cel.TypeParamType("T") |
| 99 | opts = append(opts, |
| 100 | cel.Function("cel.@block", |
| 101 | cel.Overload("cel_block_list", |
| 102 | []*cel.Type{cel.ListType(cel.DynType), paramType}, paramType)), |
| 103 | ) |
| 104 | opts = append(opts, cel.ASTValidators(blockValidationExemption{})) |
| 105 | } |
| 106 | return opts |
| 107 | } |
| 108 | |
| 109 | func (lib *celBindings) ProgramOptions() []cel.ProgramOption { |
| 110 | if lib.version >= 1 { |
nothing calls this directly
no test coverage detected