RenumberIDs performs an in-place update of the expression IDs within the SourceInfo.
(idGen IDGenerator)
| 273 | |
| 274 | // RenumberIDs performs an in-place update of the expression IDs within the SourceInfo. |
| 275 | func (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. |
| 292 | func (s *SourceInfo) SyntaxVersion() string { |