Skip to content

Commit e43cc65

Browse files
Alexey AndreevAlexey Andreev
Alexey Andreev
authored and
Alexey Andreev
committed
Fix location reported by JS parser in case of long lines
1 parent 1dae687 commit e43cc65

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

js/js.parser/src/com/google/gwt/dev/js/rhino/LineBuffer.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,7 @@ String getLine() {
236236
// Get the offset of the current character, relative to
237237
// the line that getLine() returns.
238238
int getOffset() {
239-
if (lineStart < 0)
240-
// The line begins somewhere in the other buffer.
241-
return offset + (otherEnd - otherStart);
242-
else
243-
return offset - lineStart;
239+
return offset - lineStart;
244240
}
245241

246242
private boolean fill() throws IOException {
@@ -269,7 +265,7 @@ private boolean fill() throws IOException {
269265

270266
// set lineStart to a sentinel value, unless this is the first
271267
// time around.
272-
prevStart = lineStart = (otherBuffer == null) ? 0 : -1;
268+
prevStart = lineStart = (otherBuffer == null) ? 0 : lineStart - end;
273269

274270
offset = 0;
275271
end = in.read(buffer, 0, buffer.length);

0 commit comments

Comments
 (0)