[Pkg-javascript-commits] [uglifyjs] 177/491: minor clean-ups to `evaluate` (#2197)

Jonas Smedegaard dr at jones.dk
Wed Feb 14 19:51:33 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 5f046c724bf0910e6ee7c1c3feabaf62625fa1c6
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date:   Mon Jul 3 18:52:39 2017 +0800

    minor clean-ups to `evaluate` (#2197)
---
 lib/compress.js | 57 +++++++++++++++++++++++++++------------------------------
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index f0aedf5..733abf4 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1692,12 +1692,9 @@ merge(Compressor.prototype, {
         });
         def(AST_SymbolRef, function(compressor){
             if (!compressor.option("reduce_vars")) return this;
-            this._eval = return_this;
             var fixed = this.fixed_value();
-            if (!fixed) {
-                delete this._eval;
-                return this;
-            }
+            if (!fixed) return this;
+            this._eval = return_this;
             var value = ev(fixed, compressor);
             if (value === fixed) {
                 delete this._eval;
@@ -1729,41 +1726,41 @@ merge(Compressor.prototype, {
             return this;
         });
         var object_fns = [
-            'constructor',
-            'toString',
-            'valueOf',
+            "constructor",
+            "toString",
+            "valueOf",
         ];
         var native_fns = {
             Array: makePredicate([
-                'indexOf',
-                'join',
-                'lastIndexOf',
-                'slice',
+                "indexOf",
+                "join",
+                "lastIndexOf",
+                "slice",
             ].concat(object_fns)),
             Boolean: makePredicate(object_fns),
             Number: makePredicate([
-                'toExponential',
-                'toFixed',
-                'toPrecision',
+                "toExponential",
+                "toFixed",
+                "toPrecision",
             ].concat(object_fns)),
             RegExp: makePredicate([
-                'test',
+                "test",
             ].concat(object_fns)),
             String: makePredicate([
-                'charAt',
-                'charCodeAt',
-                'concat',
-                'indexOf',
-                'italics',
-                'lastIndexOf',
-                'match',
-                'replace',
-                'search',
-                'slice',
-                'split',
-                'substr',
-                'substring',
-                'trim',
+                "charAt",
+                "charCodeAt",
+                "concat",
+                "indexOf",
+                "italics",
+                "lastIndexOf",
+                "match",
+                "replace",
+                "search",
+                "slice",
+                "split",
+                "substr",
+                "substring",
+                "trim",
             ].concat(object_fns)),
         };
         def(AST_Call, function(compressor){

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