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

Method ClearUnusedIDs

common/ast/ast.go:176–183  ·  view source on GitHub ↗

ClearUnusedIDs removes IDs not used in the AST or macro calls from SourceInfo.

()

Source from the content-addressed store, hash-verified

174
175// ClearUnusedIDs removes IDs not used in the AST or macro calls from SourceInfo.
176func (a *AST) ClearUnusedIDs() {
177 ids := a.IDs()
178 for id := range a.SourceInfo().OffsetRanges() {
179 if !ids[id] {
180 a.SourceInfo().ClearOffsetRange(id)
181 }
182 }
183}
184
185// Heights computes the heights of all AST expressions and returns a map from expression id to height.
186func Heights(a *AST) map[int64]int {

Callers 1

CheckFunction · 0.80

Calls 4

IDsMethod · 0.95
SourceInfoMethod · 0.95
OffsetRangesMethod · 0.80
ClearOffsetRangeMethod · 0.80

Tested by

no test coverage detected