[Pkg-javascript-commits] [node-acorn-jsx] 302/484: Move comprehension support under `ecmaVersion: 7` as per spec.

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:47 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 fd79ac58798bdb52e918639494f7d39353484dc3
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Mon Oct 27 02:20:23 2014 +0200

    Move comprehension support under `ecmaVersion: 7` as per spec.
---
 acorn.js              |  4 ++--
 test/tests-harmony.js | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/acorn.js b/acorn.js
index 4bcb199..a36b5da 100644
--- a/acorn.js
+++ b/acorn.js
@@ -2024,7 +2024,7 @@
       var tokStartLoc1 = tokStartLoc, tokStart1 = tokStart, val, exprList;
       next();
       // check whether this is generator comprehension or regular expression
-      if (options.ecmaVersion >= 6 && tokType === _for) {
+      if (options.ecmaVersion >= 7 && tokType === _for) {
         val = parseComprehension(startNodeAt(start), true);
       } else {
         var oldParenL = ++metParenL;
@@ -2061,7 +2061,7 @@
       var node = startNode();
       next();
       // check whether this is array comprehension or regular array
-      if (options.ecmaVersion >= 6 && tokType === _for) {
+      if (options.ecmaVersion >= 7 && tokType === _for) {
         return parseComprehension(node, false);
       }
       node.elements = parseExprList(_bracketR, true, true);
diff --git a/test/tests-harmony.js b/test/tests-harmony.js
index 1a883ee..66a802b 100644
--- a/test/tests-harmony.js
+++ b/test/tests-harmony.js
@@ -3577,7 +3577,7 @@ test("[for (x of array) x]", {
     end: {line: 1, column: 20}
   }
 }, {
-  ecmaVersion: 6,
+  ecmaVersion: 7,
   ranges: true,
   locations: true
 });
@@ -3699,7 +3699,7 @@ test("[for (x of array) for (y of array2) if (x === test) x]", {
     end: {line: 1, column: 54}
   }
 }, {
-  ecmaVersion: 6,
+  ecmaVersion: 7,
   ranges: true,
   locations: true
 });
@@ -3821,7 +3821,7 @@ test("(for (x of array) for (y of array2) if (x === test) x)", {
     end: {line: 1, column: 54}
   }
 }, {
-  ecmaVersion: 6,
+  ecmaVersion: 7,
   ranges: true,
   locations: true
 });
@@ -4025,7 +4025,7 @@ test("[for ([,x] of array) for ({[start.x]: x, [start.y]: y} of array2) x]", {
     end: {line: 1, column: 68}
   }
 }, {
-  ecmaVersion: 6,
+  ecmaVersion: 7,
   ranges: true,
   locations: true
 });
@@ -15127,17 +15127,17 @@ testFail("`hello ${10;test`", "Unexpected token (1:11)", {ecmaVersion: 6});
 
 testFail("function a() 1 // expression closure is not supported", "Unexpected token (1:13)", {ecmaVersion: 6});
 
-testFail("[for (let x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 6});
+testFail("[for (let x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 7});
 
-testFail("[for (const x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 6});
+testFail("[for (const x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 7});
 
-testFail("[for (var x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 6});
+testFail("[for (var x of []) x]", "Unexpected token (1:6)", {ecmaVersion: 7});
 
-testFail("[for (a in []) x] // (a,b) ", "Unexpected token (1:8)", {ecmaVersion: 6});
+testFail("[for (a in []) x] // (a,b) ", "Unexpected token (1:8)", {ecmaVersion: 7});
 
 testFail("var a = [if (x) x]", "Unexpected token (1:9)", {ecmaVersion: 6});
 
-testFail("[for (x of [])]  // no expression", "Unexpected token (1:14)", {ecmaVersion: 6});
+testFail("[for (x of [])]  // no expression", "Unexpected token (1:14)", {ecmaVersion: 7});
 
 testFail("({ \"chance\" }) = obj", "Unexpected token (1:12)", {ecmaVersion: 6});
 
@@ -15412,4 +15412,4 @@ test("(for (x of array) for (y of array2) if (x === test) x)", {
       type: "ComprehensionExpression"
     }
   }]
-}, {ecmaVersion: 6, preserveParens: true});
+}, {ecmaVersion: 7, preserveParens: true});

-- 
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