aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDusan Bartos <doodeec@gmail.com>2013-07-25 15:32:21 +0200
committerMihai Bazon <mihai@bazon.net>2013-07-25 17:37:47 +0300
commite54df2226f7f3887d2f850cea8caf5c0353dce00 (patch)
treed5048f4be2fd7eb8e535777c7391f81b721fea9c
parentb1febde3e9be32b9d88918ed733efc3796e3f143 (diff)
downloadtracifyjs-e54df2226f7f3887d2f850cea8caf5c0353dce00.tar.gz
tracifyjs-e54df2226f7f3887d2f850cea8caf5c0353dce00.zip
added option for dropping unused params
-rw-r--r--lib/compress.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 9eed8280..c07ccd33 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -67,6 +67,7 @@ function Compressor(options, false_by_default) {
cascade : !false_by_default,
side_effects : !false_by_default,
screw_ie8 : false,
+ drop_unused : !false_by_default,
warnings : true,
global_defs : {}
@@ -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.drop_unused) 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.drop_unused) node.drop_unused(this);
this.options.warnings = save_warnings;
}
node._squeezed = true;