Skip to content

Commit d840a87

Browse files
committed
Fix offset of token EOF
Previously was `in.length - 1`, now `in.length`
1 parent 20ad4a0 commit d840a87

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/parsing/CharArrayReader.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ abstract class CharArrayReader { self =>
3939
final def nextChar(): Unit = {
4040
val idx = charOffset
4141
lastCharOffset = idx
42+
charOffset = idx + 1
4243
if (idx >= buf.length) {
4344
ch = SU
4445
} else {
4546
val c = buf(idx)
4647
ch = c
47-
charOffset = idx + 1
4848
if (c == '\\') potentialUnicode()
4949
else if (c < ' ') { skipCR(); potentialLineEnd() }
5050
}
@@ -59,12 +59,12 @@ abstract class CharArrayReader { self =>
5959
final def nextRawChar(): Unit = {
6060
val idx = charOffset
6161
lastCharOffset = idx
62+
charOffset = idx + 1
6263
if (idx >= buf.length) {
6364
ch = SU
6465
} else {
65-
val c = buf(charOffset)
66+
val c = buf(idx)
6667
ch = c
67-
charOffset = idx + 1
6868
if (c == '\\') potentialUnicode()
6969
}
7070
}

0 commit comments

Comments
 (0)