AstNode represents an AST node for the purpose of cost estimations.
| 55 | |
| 56 | // AstNode represents an AST node for the purpose of cost estimations. |
| 57 | type 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 | |
| 76 | type astNode struct { |
| 77 | path []string |
no outgoing calls
no test coverage detected