(start *storepb.Position, source string, offset int)
| 524 | } |
| 525 | |
| 526 | func positionFromByteOffset(start *storepb.Position, source string, offset int) *storepb.Position { |
| 527 | if offset < 0 { |
| 528 | offset = 0 |
| 529 | } |
| 530 | if offset >= len(source) && len(source) > 0 { |
| 531 | offset = len(source) - 1 |
| 532 | } |
| 533 | line, column := base.CalculateLineAndColumn(source, offset) |
| 534 | startLine := int32(1) |
| 535 | if start != nil { |
| 536 | startLine = start.Line |
| 537 | } |
| 538 | return &storepb.Position{ |
| 539 | Line: startLine + int32(line), |
| 540 | Column: int32(column), |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | func dmlEndOffset(source string, loc ast.Loc) int { |
| 545 | if loc.End >= 0 && loc.End < len(source) && source[loc.End] == ';' { |
no test coverage detected