diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-09-25 12:48:36 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-09-25 12:48:36 +0300 |
commit | e836e2ae5fbc61731a9b59b075310f0234c948bc (patch) | |
tree | efeec658ae15748b7a54a68a67a22cd7a40bfffd /lib/compress.js | |
parent | ea6d1ea7014352ed81bf8d1fd461727d21ff4d12 (diff) | |
download | tracifyjs-e836e2ae5fbc61731a9b59b075310f0234c948bc.tar.gz tracifyjs-e836e2ae5fbc61731a9b59b075310f0234c948bc.zip |
minor
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js index e7c01ac1..47053c40 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -768,21 +768,34 @@ function Compressor(options, false_by_default) { /* -----[ node squeezers ]----- */ SQUEEZE(AST_Directive, function(self, compressor){ - if (self.hoisted || self.scope.has_directive(self.value) !== self.scope) { - return new AST_EmptyStatement(self); + return self.optimize(compressor); + }); + + AST_Directive.DEFMETHOD("optimize", function(compressor){ + if (this.hoisted || this.scope.has_directive(this.value) !== this.scope) { + return make_node(AST_EmptyStatement, this); } - return self; + return this; }); SQUEEZE(AST_Debugger, function(self, compressor){ + return self.optimize(compressor); + }); + + AST_Debugger.DEFMETHOD("optimize", function(compressor){ if (compressor.option("drop_debugger")) - return new AST_EmptyStatement(self); + return make_node(AST_EmptyStatement, this); + return this; }); SQUEEZE(AST_LabeledStatement, function(self, compressor){ self = self.clone(); self.body = self.body.squeeze(compressor); - return self.label.references.length == 0 ? self.body : self; + return self.optimize(compressor); + }); + + AST_LabeledStatement.DEFMETHOD("optimize", function(){ + return this.label.references.length == 0 ? this.body : this; }); SQUEEZE(AST_Statement, function(self, compressor){ |