[Pkg-javascript-commits] [uglifyjs] 121/491: clean up `lib/parse.js` (#2047)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:27 UTC 2018


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.

commit 17436218891781a5dc4fad8a9c23080c254aa695
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Sat Jun 3 14:00:59 2017 +0800

    clean up `lib/parse.js` (#2047)
    
    - remove unused definitions
    - replace `array_to_hash()`
---
 lib/parse.js | 16 ++--------------
 lib/utils.js |  7 -------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/lib/parse.js b/lib/parse.js
index a02fce8..553568e 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -115,8 +115,6 @@ var PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,;:"));
 
 var PUNC_CHARS = makePredicate(characters("[]{}(),;:"));
 
-var REGEXP_MODIFIERS = makePredicate(characters("gmsiy"));
-
 /* -----[ Tokenizer ]----- */
 
 // regexps adapted from http://xregexp.com/plugins/#unicode
@@ -684,9 +682,7 @@ var PRECEDENCE = (function(a, ret){
     {}
 );
 
-var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]);
-
-var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]);
+var ATOMIC_START_TOKEN = makePredicate([ "atom", "num", "string", "regexp", "name" ]);
 
 /* -----[ Parser ]----- */
 
@@ -1222,7 +1218,6 @@ function parse($TEXT, options) {
         var tok = S.token, ret;
         switch (tok.type) {
           case "name":
-          case "keyword":
             ret = _make_symbol(AST_SymbolRef);
             break;
           case "num":
@@ -1252,13 +1247,6 @@ function parse($TEXT, options) {
                 break;
             }
             break;
-          case "operator":
-            if (!is_identifier_string(tok.value)) {
-                croak("Invalid getter/setter name: " + tok.value,
-                    tok.line, tok.col, tok.pos);
-            }
-            ret = _make_symbol(AST_SymbolRef);
-            break;
         }
         next();
         return ret;
@@ -1292,7 +1280,7 @@ function parse($TEXT, options) {
             func.end = prev();
             return subscripts(func, allow_calls);
         }
-        if (ATOMIC_START_TOKEN[S.token.type]) {
+        if (ATOMIC_START_TOKEN(S.token.type)) {
             return subscripts(as_atom_node(), allow_calls);
         }
         unexpected();
diff --git a/lib/utils.js b/lib/utils.js
index e21fc5e..7630691 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -43,13 +43,6 @@
 
 "use strict";
 
-function array_to_hash(a) {
-    var ret = Object.create(null);
-    for (var i = 0; i < a.length; ++i)
-        ret[a[i]] = true;
-    return ret;
-};
-
 function slice(a, start) {
     return Array.prototype.slice.call(a, start || 0);
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list