Fixed: tokLineStart and tokCurLine have no meaning if options.locations is false.

Everywhere else (except one place which is a bug) those variables only appear within an `if (options.locations)` block.
This commit is contained in:
Aparajita Fishman
2013-10-08 15:31:07 -04:00
committed by Marijn Haverbeke
parent b7972ad95c
commit 389c9b225b

View File

@@ -529,8 +529,10 @@
}
} else if (ch === 10 || ch === 8232 || ch === 8233) {
++tokPos;
++tokCurLine;
tokLineStart = tokPos;
if (options.locations) {
++tokCurLine;
tokLineStart = tokPos;
}
} else if (ch > 8 && ch < 14) {
++tokPos;
} else if (ch === 47) { // '/'
@@ -967,9 +969,11 @@
function setStrict(strct) {
strict = strct;
tokPos = lastEnd;
while (tokPos < tokLineStart) {
tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
--tokCurLine;
if (options.locations) {
while (tokPos < tokLineStart) {
tokLineStart = input.lastIndexOf("\n", tokLineStart - 2) + 1;
--tokCurLine;
}
}
skipSpace();
readToken();