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

Interface AstNode

checker/cost.go:58–75  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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