@@ -16,27 +16,27 @@ final class InterpolationMap {
1616 /// The interpolation from which this map was generated.
1717 final Interpolation _interpolation;
1818
19- /// Locations in the generated string.
19+ /// Location offsets in the generated string.
2020 ///
2121 /// Each of these indicates the location in the generated string that
2222 /// corresponds to the end of the component at the same index of
2323 /// [_interpolation.contents] . Its length is always one less than
2424 /// [_interpolation.contents] because the last element always ends the string.
25- final List <SourceLocation > _targetLocations ;
25+ final List <int > _targetOffsets ;
2626
27- /// Creates a new interpolation map that maps the given [targetLocations ] in
28- /// the generated string to the contents of the interpolation.
27+ /// Creates a new interpolation map that maps the given [targetOffsets ] in the
28+ /// generated string to the contents of the interpolation.
2929 ///
30- /// Each target location at index `i` corresponds to the character in the
30+ /// Each target offset at index `i` corresponds to the character in the
3131 /// generated string after `interpolation.contents[i]` .
3232 InterpolationMap (
3333 this ._interpolation,
34- Iterable <SourceLocation > targetLocations ,
35- ) : _targetLocations = List .unmodifiable (targetLocations ) {
34+ Iterable <int > targetOffsets ,
35+ ) : _targetOffsets = List .unmodifiable (targetOffsets ) {
3636 var expectedLocations = math.max (0 , _interpolation.contents.length - 1 );
37- if (_targetLocations .length != expectedLocations) {
37+ if (_targetOffsets .length != expectedLocations) {
3838 throw ArgumentError (
39- "InterpolationMap must have $expectedLocations targetLocations if the "
39+ "InterpolationMap must have $expectedLocations targetOffsets if the "
4040 "interpolation has ${_interpolation .contents .length } components." ,
4141 );
4242 }
@@ -139,7 +139,7 @@ final class InterpolationMap {
139139 ),
140140 );
141141 var offsetInString =
142- target.offset - (index == 0 ? 0 : _targetLocations [index - 1 ].offset );
142+ target.offset - (index == 0 ? 0 : _targetOffsets [index - 1 ]);
143143
144144 // This produces slightly incorrect mappings if there are _unnecessary_
145145 // escapes in the source file, but that's unlikely enough that it's probably
@@ -151,8 +151,8 @@ final class InterpolationMap {
151151
152152 /// Return the index in [_interpolation.contents] at which [target] points.
153153 int _indexInContents (SourceLocation target) {
154- for (var i = 0 ; i < _targetLocations .length; i++ ) {
155- if (target.offset < _targetLocations [i].offset ) return i;
154+ for (var i = 0 ; i < _targetOffsets .length; i++ ) {
155+ if (target.offset < _targetOffsets [i]) return i;
156156 }
157157
158158 return _interpolation.contents.length - 1 ;
0 commit comments