[Pkg-javascript-commits] [uglifyjs] 23/190: Control keeping function arguments with a single option

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Aug 7 23:17:09 UTC 2016


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

terceiro pushed a commit to annotated tag upstream/2.7.0
in repository uglifyjs.

commit 5fd12451f90eb6ae8f009da41197ad5da9e0fee8
Author: Ville Lautanala <lautis at gmail.com>
Date:   Sat May 23 01:46:08 2015 +0300

    Control keeping function arguments with a single option
---
 lib/compress.js              | 4 ++--
 test/compress/drop-unused.js | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/compress.js b/lib/compress.js
index 51dd66f..8360473 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -61,7 +61,7 @@ function Compressor(options, false_by_default) {
         loops         : !false_by_default,
         unused        : !false_by_default,
         hoist_funs    : !false_by_default,
-        keep_fargs    : false,
+        keep_fargs    : true,
         keep_fnames   : false,
         hoist_vars    : false,
         if_return     : !false_by_default,
@@ -1087,7 +1087,7 @@ merge(Compressor.prototype, {
             var tt = new TreeTransformer(
                 function before(node, descend, in_list) {
                     if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) {
-                        if (compressor.option("unsafe") && !compressor.option("keep_fargs")) {
+                        if (!compressor.option("keep_fargs")) {
                             for (var a = node.argnames, i = a.length; --i >= 0;) {
                                 var sym = a[i];
                                 if (sym.unreferenced()) {
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index c1cf5c3..035a428 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1,5 +1,5 @@
 unused_funarg_1: {
-    options = { unused: true, unsafe: true };
+    options = { unused: true, keep_fargs: false };
     input: {
         function f(a, b, c, d, e) {
             return a + b;
@@ -13,7 +13,7 @@ unused_funarg_1: {
 }
 
 unused_funarg_2: {
-    options = { unused: true, unsafe: true };
+    options = { unused: true, keep_fargs: false };
     input: {
         function f(a, b, c, d, e) {
             return a + c;
@@ -173,7 +173,7 @@ keep_fnames: {
     }
     expect: {
         function foo() {
-            return function bar() {};
+            return function bar(baz) {};
         }
     }
 }

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