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