[Pkg-javascript-commits] [node-acorn-jsx] 153/484: Fixed: tokLineStart and tokCurLine have no meaning if options.locations is false.
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-acorn-jsx.
commit 389c9b225bff54eaf12c9c613d25f3b3aa2acd1b
Author: Aparajita Fishman <aparajita at aparajita.com>
Date: Tue Oct 8 15:31:07 2013 -0400
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.
---
acorn.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/acorn.js b/acorn.js
index e115f88..945439c 100644
--- a/acorn.js
+++ b/acorn.js
@@ -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();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git
More information about the Pkg-javascript-commits
mailing list