[Pkg-javascript-commits] [node-acorn-jsx] 355/484: Make semicolon optional in do-while in >=ES6
Bastien Roucariès
rouca at moszumanska.debian.org
Sat Aug 19 14:20:55 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 53d98f1175d69c8117168bfcb30b9285c414dd8b
Author: Sebastian McKenzie <sebmck at gmail.com>
Date: Wed Dec 10 18:59:24 2014 +1100
Make semicolon optional in do-while in >=ES6
---
acorn.js | 5 ++++-
test/tests-harmony.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/acorn.js b/acorn.js
index 8795639..e39c326 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1605,7 +1605,10 @@
labels.pop();
expect(_while);
node.test = parseParenExpression();
- semicolon();
+ if (options.ecmaVersion >= 6)
+ eat(_semi);
+ else
+ semicolon();
return finishNode(node, "DoWhileStatement");
}
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 50fe007..9180e29 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -13605,6 +13605,52 @@ test("/[a-z]/u", {
ecmaVersion: 6
});
+
+test("do {} while (false) foo();", {
+ type: "Program",
+ start: 0,
+ end: 26,
+ body: [
+ {
+ type: "DoWhileStatement",
+ start: 0,
+ end: 19,
+ body: {
+ type: "BlockStatement",
+ start: 3,
+ end: 5,
+ body: []
+ },
+ test: {
+ type: "Literal",
+ start: 13,
+ end: 18,
+ value: false,
+ raw: "false"
+ }
+ },
+ {
+ type: "ExpressionStatement",
+ start: 20,
+ end: 26,
+ expression: {
+ type: "CallExpression",
+ start: 20,
+ end: 25,
+ callee: {
+ type: "Identifier",
+ start: 20,
+ end: 23,
+ name: "foo"
+ },
+ arguments: []
+ }
+ }
+ ]
+}, {
+ ecmaVersion: 6
+});
+
// Harmony Invalid syntax
testFail("0o", "Expected number in radix 8 (1:2)", {ecmaVersion: 6});
--
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