@@ -26,20 +26,16 @@ import (
26
26
// MappedRange provides mapped protocol.Range for a span.Range, accounting for
27
27
// UTF-16 code points.
28
28
//
29
- // TOOD(adonovan): eliminate this type. All callers need either m, or a protocol.Range.
29
+ // TOOD(adonovan): eliminate this type. Replace all uses by an
30
+ // explicit pair (span.Range, protocol.ColumnMapper), and an operation
31
+ // to map both to a protocol.Range.
30
32
type MappedRange struct {
31
33
spanRange span.Range // the range in the compiled source (package.CompiledGoFiles)
32
34
m * protocol.ColumnMapper // a mapper of the edited source (package.GoFiles)
33
35
}
34
36
35
- // NewMappedRange returns a MappedRange for the given file and valid start/end token.Pos.
36
- //
37
- // By convention, start and end are assumed to be positions in the compiled (==
38
- // type checked) source, whereas the column mapper m maps positions in the
39
- // user-edited source. Note that these may not be the same, as when using goyacc or CGo:
40
- // CompiledGoFiles contains generated files, whose positions (via
41
- // token.File.Position) point to locations in the edited file -- the file
42
- // containing `import "C"`.
37
+ // NewMappedRange returns a MappedRange for the given file and
38
+ // start/end positions, which must be valid within m.TokFile.
43
39
func NewMappedRange (m * protocol.ColumnMapper , start , end token.Pos ) MappedRange {
44
40
return MappedRange {
45
41
spanRange : span .NewRange (m .TokFile , start , end ),
0 commit comments