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

Function genRange

ext/lists.go:420–432  ·  view source on GitHub ↗
(n types.Int, maxSize int64)

Source from the content-addressed store, hash-verified

418}
419
420func genRange(n types.Int, maxSize int64) (ref.Val, error) {
421 if n < 0 {
422 return nil, fmt.Errorf("lists.range: size must be non-negative, got %d", n)
423 }
424 if maxSize > 0 && int64(n) > maxSize {
425 return nil, fmt.Errorf("lists.range: size %d exceeds maximum allowed (%d)", n, maxSize)
426 }
427 newList := make([]ref.Val, 0, n)
428 for i := types.Int(0); i < n; i++ {
429 newList = append(newList, i)
430 }
431 return types.DefaultTypeAdapter.NativeToValue(newList), nil
432}
433
434func reverseList(list traits.Lister) (ref.Val, error) {
435 var newList []ref.Val

Callers 2

TestGenRangeMaxSizeFunction · 0.85
CompileOptionsMethod · 0.85

Calls 2

IntTypeAlias · 0.92
NativeToValueMethod · 0.65

Tested by 1

TestGenRangeMaxSizeFunction · 0.68