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

Method RenumberIDs

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

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

Callers 1

Calls 1

SortMethod · 0.45

Tested by 1