From 0e1f5e29908d91f9170f77afce901a6c72bc77ce Mon Sep 17 00:00:00 2001 From: Dusan Bartos Date: Thu, 25 Jul 2013 15:32:21 +0200 Subject: [PATCH] added option for dropping unused params --- lib/compress.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/compress.js b/lib/compress.js index 9eed8280..34eb95d7 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -68,6 +68,7 @@ function Compressor(options, false_by_default) { side_effects : !false_by_default, screw_ie8 : false, + dropUnused : true, warnings : true, global_defs : {} }, true); @@ -83,7 +84,7 @@ merge(Compressor.prototype, { before: function(node, descend, in_list) { if (node._squeezed) return node; if (node instanceof AST_Scope) { - node.drop_unused(this); + if (this.options.dropUnused) node.drop_unused(this); node = node.hoist_declarations(this); } descend(node, this); @@ -96,7 +97,7 @@ merge(Compressor.prototype, { // no point to repeat warnings. var save_warnings = this.options.warnings; this.options.warnings = false; - node.drop_unused(this); + if (this.options.dropUnused) node.drop_unused(this); this.options.warnings = save_warnings; } node._squeezed = true;