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

Function MaxID

common/ast/ast.go:153–163  ·  view source on GitHub ↗

MaxID returns the upper-bound, non-inclusive, of ids present within the AST's Expr value.

(a *AST)

Source from the content-addressed store, hash-verified

151
152// MaxID returns the upper-bound, non-inclusive, of ids present within the AST's Expr value.
153func MaxID(a *AST) int64 {
154 visitor := &maxIDVisitor{maxID: 1}
155 PostOrderVisit(a.Expr(), visitor)
156 for id, call := range a.SourceInfo().MacroCalls() {
157 PostOrderVisit(call, visitor)
158 if id > visitor.maxID {
159 visitor.maxID = id + 1
160 }
161 }
162 return visitor.maxID + 1
163}
164
165// IDs returns the set of AST node IDs, including macro calls.
166func (a *AST) IDs() map[int64]bool {

Callers 3

OptimizeMethod · 0.92
TestMaxIDFunction · 0.92
TestNavigateASTFunction · 0.92

Calls 4

PostOrderVisitFunction · 0.85
ExprMethod · 0.65
MacroCallsMethod · 0.45
SourceInfoMethod · 0.45

Tested by 2

TestMaxIDFunction · 0.74
TestNavigateASTFunction · 0.74