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

Method CompileOptions

conformance/conformance_test.go:336–356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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