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

Method costCreateList

checker/cost.go:607–621  ·  view source on GitHub ↗
(e ast.Expr)

Source from the content-addressed store, hash-verified

605}
606
607func (c *coster) costCreateList(e ast.Expr) CostEstimate {
608 create := e.AsList()
609 var sum CostEstimate
610 itemSize := SizeEstimate{Min: math.MaxUint64, Max: 0}
611 if create.Size() == 0 {
612 itemSize.Min = 0
613 }
614 for _, e := range create.Elements() {
615 sum = sum.Add(c.cost(e))
616 is := c.sizeOrUnknown(e)
617 itemSize = itemSize.Union(is)
618 }
619 c.setEntrySize(e, &entrySizeEstimate{containerKind: types.ListKind, key: FixedSizeEstimate(1), val: itemSize})
620 return sum.Add(createListBaseCost)
621}
622
623func (c *coster) costCreateMap(e ast.Expr) CostEstimate {
624 mapVal := e.AsMap()

Callers 1

costMethod · 0.95

Calls 9

AddMethod · 0.95
costMethod · 0.95
sizeOrUnknownMethod · 0.95
UnionMethod · 0.95
setEntrySizeMethod · 0.95
FixedSizeEstimateFunction · 0.85
AsListMethod · 0.65
SizeMethod · 0.65
ElementsMethod · 0.65

Tested by

no test coverage detected