aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2015-01-05 11:03:13 +0200
committerMihai Bazon <mihai@bazon.net>2015-01-05 11:03:13 +0200
commite1f0747e4cca7b77a0189dacbff9fa4800a2835c (patch)
tree013bd242a4107d3cd9046e8038823637c7a1d9e7 /lib/compress.js
parente37b67d013c4537a36bb3c24f4f99e72efbf6d4b (diff)
downloadtracifyjs-e1f0747e4cca7b77a0189dacbff9fa4800a2835c.tar.gz
tracifyjs-e1f0747e4cca7b77a0189dacbff9fa4800a2835c.zip
Support keep_fnames in compressor, and --keep-fnames. #552
Passing `--keep-fnames` will enable it both for compressor/mangler, so that function names will not be dropped (when unused) nor mangled.
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 2c950992..345d8ad6 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -62,6 +62,7 @@ function Compressor(options, false_by_default) {
unused : !false_by_default,
hoist_funs : !false_by_default,
keep_fargs : false,
+ keep_fnames : false,
hoist_vars : false,
if_return : !false_by_default,
join_vars : !false_by_default,
@@ -1666,7 +1667,7 @@ merge(Compressor.prototype, {
OPT(AST_Function, function(self, compressor){
self = AST_Lambda.prototype.optimize.call(self, compressor);
- if (compressor.option("unused")) {
+ if (compressor.option("unused") && !compressor.option("keep_fnames")) {
if (self.name && self.name.unreferenced()) {
self.name = null;
}