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

Method ClearUnusedIDs

common/ast/ast.go:184–191  ·  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

182
183// ClearUnusedIDs removes IDs not used in the AST or macro calls from SourceInfo.
184func (a *AST) ClearUnusedIDs() {
185 ids := a.IDs()
186 for id := range a.SourceInfo().OffsetRanges() {
187 if !ids[id] {
188 a.SourceInfo().ClearOffsetRange(id)
189 }
190 }
191}
192
193// Heights computes the heights of all AST expressions and returns a map from expression id to height.
194func 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