()
| 333 | } |
| 334 | |
| 335 | func (celBlockLib) CompileOptions() []cel.EnvOption { |
| 336 | // Simulate indexed arguments which would normally have strong types associated |
| 337 | // with the values as part of a static optimization pass |
| 338 | maxIndices := 30 |
| 339 | indexOpts := make([]cel.EnvOption, maxIndices) |
| 340 | for i := 0; i < maxIndices; i++ { |
| 341 | indexOpts[i] = cel.Variable(fmt.Sprintf("@index%d", i), cel.DynType) |
| 342 | } |
| 343 | return append([]cel.EnvOption{ |
| 344 | cel.Macros( |
| 345 | // cel.block([args], expr) |
| 346 | cel.ReceiverMacro("block", 2, celBlock), |
| 347 | // cel.index(int) |
| 348 | cel.ReceiverMacro("index", 1, celIndex), |
| 349 | // cel.iterVar(int, int) |
| 350 | cel.ReceiverMacro("iterVar", 2, celCompreVar("cel.iterVar", "@it")), |
| 351 | // cel.accuVar(int, int) |
| 352 | cel.ReceiverMacro("accuVar", 2, celCompreVar("cel.accuVar", "@ac")), |
| 353 | ), |
| 354 | }, indexOpts...) |
| 355 | } |
| 356 | |
| 357 | func (celBlockLib) ProgramOptions() []cel.ProgramOption { |
| 358 | return []cel.ProgramOption{} |
nothing calls this directly
no test coverage detected