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

Method RenumberIDs

common/ast/ast.go:267–281  ·  view source on GitHub ↗

RenumberIDs performs an in-place update of the expression IDs within the SourceInfo.

(idGen IDGenerator)

Source from the content-addressed store, hash-verified

265
266// RenumberIDs performs an in-place update of the expression IDs within the SourceInfo.
267func (s *SourceInfo) RenumberIDs(idGen IDGenerator) {
268 if s == nil {
269 return
270 }
271 oldIDs := []int64{}
272 for id := range s.offsetRanges {
273 oldIDs = append(oldIDs, id)
274 }
275 slices.Sort(oldIDs)
276 newRanges := make(map[int64]OffsetRange)
277 for _, id := range oldIDs {
278 newRanges[idGen(id)] = s.offsetRanges[id]
279 }
280 s.offsetRanges = newRanges
281}
282
283// SyntaxVersion returns the syntax version associated with the text expression.
284func (s *SourceInfo) SyntaxVersion() string {

Callers 1

Calls 1

SortMethod · 0.45

Tested by 1