[Pkg-javascript-commits] [node-acorn-jsx] 11/484: Shuffle parseExprAtom for expected probabilities

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:19:56 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 60178c3d6845e7944025cf08e5e9354a8bf85677
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Mon Sep 24 22:06:44 2012 +0200

    Shuffle parseExprAtom for expected probabilities
---
 acorn.js | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/acorn.js b/acorn.js
index 9e7849b..5cfca5b 100644
--- a/acorn.js
+++ b/acorn.js
@@ -461,9 +461,26 @@
   }
 
   function parseExprAtom() {
-    if (tokType === _new) return parseNew();
-
     switch (tokType) {
+    case _name:
+      if (tokVal === "this") {
+        var node = startNode();
+        next();
+        return finishNode(node, "ThisExpression");
+      } else return parseIdent();
+
+    case _num: case _string: case _regexp:
+      var node = startNode();
+      node.value = tokVal;
+      next();
+      return finishNode(node, "Literal");
+
+    case _null: case _true: case _false:
+      var node = startNode();
+      node.value = tokType.atomValue;
+      next();
+      return finishNode(node, "Literal");
+
     case _parenL:
       next();
       var val = parseExpression();
@@ -484,24 +501,8 @@
       next();
       return parseFunction(node, false);
 
-    case _num: case _string: case _regexp:
-      var node = startNode();
-      node.value = tokVal;
-      next();
-      return finishNode(node, "Literal");
-
-    case _null: case _true: case _false:
-      var node = startNode();
-      node.value = tokType.atomValue;
-      next();
-      return finishNode(node, "Literal");
-
-    case _name:
-      if (tokVal === "this") {
-        var node = startNode();
-        next();
-        return finishNode(node, "ThisExpression");
-      } else return parseIdent();
+    case _new:
+      return parseNew();
 
     default:
       unexpected();

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