Skip to content

Commit eb7ece5

Browse files
committed
Code review comments
1 parent 6e739d3 commit eb7ece5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/compiler/utilities.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,22 @@ namespace ts {
184184
const lineStarts = getLineStarts(sourceFile);
185185

186186
const lineIndex = line;
187+
const sourceText = sourceFile.text;
187188
if (lineIndex + 1 === lineStarts.length) {
188189
// last line - return EOF
189-
return sourceFile.text.length - 1;
190+
return sourceText.length - 1;
190191
}
191192
else {
192193
// current line start
193194
const start = lineStarts[lineIndex];
194-
// take the start position of the next line -1 = it should be some line break
195+
// take the start position of the next line - 1 = it should be some line break
195196
let pos = lineStarts[lineIndex + 1] - 1;
196-
Debug.assert(isLineBreak(sourceFile.text.charCodeAt(pos)));
197+
Debug.assert(isLineBreak(sourceText.charCodeAt(pos)));
197198
// walk backwards skipping line breaks, stop the the beginning of current line.
198199
// i.e:
199200
// <some text>
200201
// $ <- end of line for this position should match the start position
201-
while (start <= pos && isLineBreak(sourceFile.text.charCodeAt(pos))) {
202+
while (start <= pos && isLineBreak(sourceText.charCodeAt(pos))) {
202203
pos--;
203204
}
204205
return pos;

0 commit comments

Comments
 (0)