[Pkg-javascript-commits] [node-acorn-jsx] 291/484: Strict mode incorrectly reset after function
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:45 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 f3e759cd03e575239b521a577d53ca8d6c400c64
Author: r-e-d <renaud.durlin at gmail.com>
Date: Tue Sep 30 10:58:21 2014 +0200
Strict mode incorrectly reset after function
---
acorn.js | 6 +++---
test/tests.js | 3 +++
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/acorn.js b/acorn.js
index 8d4760d..24b7ff5 100644
--- a/acorn.js
+++ b/acorn.js
@@ -302,7 +302,7 @@
function initParserState() {
lastStart = lastEnd = tokPos;
if (options.locations) lastEndLoc = new Position;
- inFunction = inGenerator = strict = null;
+ inFunction = inGenerator = strict = false;
labels = [];
readToken();
}
@@ -1752,7 +1752,7 @@
// function bodies).
function parseBlock(allowStrict) {
- var node = startNode(), first = true, strict = false, oldStrict;
+ var node = startNode(), first = true, oldStrict;
node.body = [];
expect(_braceL);
while (!eat(_braceR)) {
@@ -1764,7 +1764,7 @@
}
first = false;
}
- if (strict && !oldStrict) setStrict(false);
+ if (oldStrict === false) setStrict(false);
return finishNode(node, "BlockStatement");
}
diff --git a/test/tests.js b/test/tests.js
index 40069ee..c39aa3c 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -27285,6 +27285,9 @@ testFail("(function a(eval) { \"use strict\"; })",
testFail("(function a(package) { \"use strict\"; })",
"Defining 'package' in strict mode (1:12)");
+testFail("\"use strict\";function foo(){\"use strict\";}function bar(){var v = 015}",
+ "Invalid number (1:65)");
+
testFail("var this = 10;", "Unexpected token (1:4)");
testFail("throw\n10;", "Illegal newline after throw (1:5)");
--
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