MCPcopy Create free account
hub / github.com/cel-expr/cel-go / CompileOptions

Method CompileOptions

conformance/conformance_test.go:335–355  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

333}
334
335func (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
357func (celBlockLib) ProgramOptions() []cel.ProgramOption {
358 return []cel.ProgramOption{}

Callers

nothing calls this directly

Calls 4

VariableFunction · 0.92
MacrosFunction · 0.92
ReceiverMacroFunction · 0.92
celCompreVarFunction · 0.85

Tested by

no test coverage detected