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

Interface AstNode

checker/cost.go:57–74  ·  view source on GitHub ↗

AstNode represents an AST node for the purpose of cost estimations.

Source from the content-addressed store, hash-verified

55
56// AstNode represents an AST node for the purpose of cost estimations.
57type AstNode interface {
58 // Path returns a field path through the provided type declarations to the type of the AstNode, or nil if the AstNode does not
59 // represent type directly reachable from the provided type declarations.
60 // The first path element is a variable. All subsequent path elements are one of: field name, '@items', '@keys', '@values'.
61 Path() []string
62
63 // Type returns the deduced type of the AstNode.
64 Type() *types.Type
65
66 // Expr returns the expression of the AstNode.
67 Expr() ast.Expr
68
69 // ComputedSize returns a size estimate of the AstNode derived from information available in the CEL expression.
70 // For constants and inline list and map declarations, the exact size is returned. For concatenated list, strings
71 // and bytes, the size is derived from the size estimates of the operands. nil is returned if there is no
72 // computed size available.
73 ComputedSize() *SizeEstimate
74}
75
76type astNode struct {
77 path []string

Callers 28

registerMessagesFunction · 0.65
EstimateSizeMethod · 0.65
EstimateSizeMethod · 0.65
listElementNodeFunction · 0.65
EstimateSizeMethod · 0.65
estimateFlattenSizeFunction · 0.65
estimateItemSizeFunction · 0.65
EstimateSizeMethod · 0.65
registerVariableMethod · 0.65
compileRuleMethod · 0.65

Implementers 2

astNodechecker/cost.go
pathAstNodeext/lists.go

Calls

no outgoing calls

Tested by

no test coverage detected