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

Function nodeAsUintValue

ext/costs.go:69–82  ·  view source on GitHub ↗
(node checker.AstNode, defaultVal uint64)

Source from the content-addressed store, hash-verified

67}
68
69func nodeAsUintValue(node checker.AstNode, defaultVal uint64) uint64 {
70 if node.Expr().Kind() != ast.LiteralKind {
71 return defaultVal
72 }
73 lit := node.Expr().AsLiteral()
74 if lit.Type() != types.IntType {
75 return defaultVal
76 }
77 val := lit.(types.Int)
78 if val < types.IntZero {
79 return 0
80 }
81 return uint64(lit.(types.Int))
82}
83
84func callEstimate(cost checker.CostEstimate, sz *checker.SizeEstimate) *checker.CallEstimate {
85 return &checker.CallEstimate{CostEstimate: cost, ResultSize: sz}

Callers 4

estimateSubstringCostFunction · 0.85
estimateListSliceFunction · 0.85
estimateListsRangeFunction · 0.85
estimateListFlattenFunction · 0.85

Calls 4

KindMethod · 0.65
ExprMethod · 0.65
AsLiteralMethod · 0.65
TypeMethod · 0.65

Tested by

no test coverage detected