From e43cc65702fd2bae75baf66d8068bbe9d251b8ad Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 22 May 2017 19:36:47 +0300 Subject: [PATCH] Fix location reported by JS parser in case of long lines --- .../src/com/google/gwt/dev/js/rhino/LineBuffer.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/js/js.parser/src/com/google/gwt/dev/js/rhino/LineBuffer.java b/js/js.parser/src/com/google/gwt/dev/js/rhino/LineBuffer.java index 5cb7c34f094..7576d2a34e0 100644 --- a/js/js.parser/src/com/google/gwt/dev/js/rhino/LineBuffer.java +++ b/js/js.parser/src/com/google/gwt/dev/js/rhino/LineBuffer.java @@ -236,11 +236,7 @@ final class LineBuffer { // Get the offset of the current character, relative to // the line that getLine() returns. int getOffset() { - if (lineStart < 0) - // The line begins somewhere in the other buffer. - return offset + (otherEnd - otherStart); - else - return offset - lineStart; + return offset - lineStart; } private boolean fill() throws IOException { @@ -269,7 +265,7 @@ final class LineBuffer { // set lineStart to a sentinel value, unless this is the first // time around. - prevStart = lineStart = (otherBuffer == null) ? 0 : -1; + prevStart = lineStart = (otherBuffer == null) ? 0 : lineStart - end; offset = 0; end = in.read(buffer, 0, buffer.length);