[Pkg-javascript-commits] [node-acorn-jsx] 240/484: Allow some keywords to be treated as identifier names; update ecmaVersion in benchmark.

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:37 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 82b9f30fc95f0ef845ada9bd3ceeb92a69d4dff2
Author: Ingvar Stepanyan <me at rreverser.com>
Date:   Sat Jul 26 08:56:22 2014 +0300

    Allow some keywords to be treated as identifier names; update ecmaVersion in benchmark.
---
 acorn.js        | 12 ++++++++----
 test/bench.html |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/acorn.js b/acorn.js
index 5fd4225..dc0ba67 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1761,8 +1761,15 @@
       next();
       return finishNode(node, "ThisExpression");
     
+    case _yield:
+      if (inGenerator) return parseYield();
+
     case _name:
-      var id = parseIdent();
+    case _static:
+    case _from:
+    case _of:
+    case _as:
+      var id = parseIdent(tokType !== _name);
       if (eat(_arrow)) {
         return parseArrowExpression(startNodeFrom(id), [id]);
       }
@@ -1865,9 +1872,6 @@
     case _bquote:
       return parseTemplate();
 
-    case _yield:
-      return inGenerator ? parseYield() : parseIdent(true);
-
     default:
       unexpected();
     }
diff --git a/test/bench.html b/test/bench.html
index 59c9fa2..31494f6 100644
--- a/test/bench.html
+++ b/test/bench.html
@@ -36,7 +36,7 @@ numbers.</p>
 
 <script>
   function runAcorn(code, locations) {
-    acorn.parse(code, {locations: locations});
+    acorn.parse(code, {ecmaVersion: 6, locations: locations});
   }
   function runEsprima(code, locations) {
     esprima.parse(code, {loc: locations});

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