diff --git a/acorn.js b/acorn.js index f6a6a4010c..b9d32d5e0c 100644 --- a/acorn.js +++ b/acorn.js @@ -154,7 +154,6 @@ tokLineStart = match.index + match[0].length; } } - var ch = input.charAt(pos - 1); tokRegexpAllowed = reAllowed; skipSpace(); }; @@ -1332,11 +1331,11 @@ while (!eat(_braceR)) { var stmt = parseStatement(); node.body.push(stmt); - if (first && isUseStrict(stmt)) { + if (first && allowStrict && isUseStrict(stmt)) { oldStrict = strict; setStrict(strict = true); } - first = false + first = false; } if (strict && !oldStrict) setStrict(false); return finishNode(node, "BlockStatement"); @@ -1548,7 +1547,7 @@ case _null: case _true: case _false: var node = startNode(); node.value = tokType.atomValue; - node.raw = tokType.keyword + node.raw = tokType.keyword; next(); return finishNode(node, "Literal"); diff --git a/acorn_loose.js b/acorn_loose.js index 8b3ea85d64..105fe7ddc2 100644 --- a/acorn_loose.js +++ b/acorn_loose.js @@ -168,10 +168,6 @@ while (pos < input.length && !isNewline(input.charCodeAt(pos))) ++pos; return pos; } - function lineStart(pos) { - while (pos > 0 && !isNewline(input.charCodeAt(pos - 1))) --pos; - return pos; - } function indentationAfter(pos) { for (var count = 0;; ++pos) { var ch = input.charCodeAt(pos); @@ -426,7 +422,7 @@ return finishNode(node, "EmptyStatement"); default: - var maybeName = token.value, expr = parseExpression(); + var expr = parseExpression(); if (isDummy(expr)) { next(); if (token.type === tt.eof) return finishNode(node, "EmptyStatement"); @@ -582,8 +578,7 @@ } function parseExprSubscripts() { - var indent = curIndent, line = curLineStart; - return parseSubscripts(parseExprAtom(), false, curIndent, line); + return parseSubscripts(parseExprAtom(), false, curIndent, curLineStart); } function parseSubscripts(base, noCalls, startIndent, line) { diff --git a/index.html b/index.html index e877bc1d03..fac2e0328d 100644 --- a/index.html +++ b/index.html @@ -110,7 +110,6 @@ reset the internal state, and invalidate existing tokenizers.

tokLineStart = match.index + match[0].length; } } - var ch = input.charAt(pos - 1); tokRegexpAllowed = reAllowed; skipSpace(); }; @@ -978,11 +977,11 @@ function bodies).

while (!eat(_braceR)) { var stmt = parseStatement(); node.body.push(stmt); - if (first && isUseStrict(stmt)) { + if (first && allowStrict && isUseStrict(stmt)) { oldStrict = strict; setStrict(strict = true); } - first = false + first = false; } if (strict && !oldStrict) setStrict(false); return finishNode(node, "BlockStatement"); @@ -1146,7 +1145,7 @@ or {}.

case _null: case _true: case _false: var node = startNode(); node.value = tokType.atomValue; - node.raw = tokType.keyword + node.raw = tokType.keyword; next(); return finishNode(node, "Literal"); diff --git a/util/walk.js b/util/walk.js index e1e02f27a1..49e44b1f7c 100644 --- a/util/walk.js +++ b/util/walk.js @@ -144,7 +144,7 @@ }; function skipThrough(node, st, c) { c(node, st); } - function ignore(node, st, c) {} + function ignore(_node, _st, _c) {} // Node walkers.