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

Method ProgramOptions

ext/lists.go:413–448  ·  view source on GitHub ↗

ProgramOptions implements the Library interface method.

()

Source from the content-addressed store, hash-verified

411
412// ProgramOptions implements the Library interface method.
413func (lib *listsLib) ProgramOptions() []cel.ProgramOption {
414 var opts []cel.ProgramOption
415 if lib.version >= 3 {
416 trackers := []interpreter.CostTrackerOption{
417 interpreter.OverloadCostTracker("list_slice", trackListOutputSize),
418 interpreter.OverloadCostTracker("lists_range", trackListOutputSize),
419 interpreter.OverloadCostTracker("list_reverse", trackListOutputSize),
420 interpreter.OverloadCostTracker("list_distinct", trackListDistinct),
421 }
422 if lib.version == 3 {
423 trackers = append(trackers,
424 interpreter.OverloadCostTracker("list_flatten", trackListFlattenLegacy),
425 interpreter.OverloadCostTracker("list_flatten_int", trackListFlattenLegacy),
426 )
427 } else {
428 trackers = append(trackers,
429 interpreter.OverloadCostTracker("list_flatten", trackListFlatten),
430 interpreter.OverloadCostTracker("list_flatten_int", trackListFlatten),
431 )
432 }
433 for _, t := range comparableTypes {
434 trackers = append(trackers,
435 interpreter.OverloadCostTracker(
436 fmt.Sprintf("list_%s_sort", t.TypeName()),
437 trackListSort,
438 ),
439 interpreter.OverloadCostTracker(
440 fmt.Sprintf("list_%s_sortByAssociatedKeys", t.TypeName()),
441 trackListSortBy,
442 ),
443 )
444 }
445 opts = append(opts, cel.CostTrackerOptions(trackers...))
446 }
447 return opts
448}
449
450func genRange(n types.Int, maxSize int64) (ref.Val, error) {
451 if n < 0 {

Callers

nothing calls this directly

Calls 3

OverloadCostTrackerFunction · 0.92
CostTrackerOptionsFunction · 0.92
TypeNameMethod · 0.65

Tested by

no test coverage detected