aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 834cc388..89352c00 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -690,6 +690,13 @@ function Compressor(options, false_by_default) {
def(AST_Constant, function(){ return false });
def(AST_This, function(){ return false });
def(AST_Function, function(){ return false });
+ def(AST_BlockStatement, function(){
+ for (var i = this.body.length; --i >= 0;) {
+ if (this.body[i].has_side_effects())
+ return true;
+ }
+ return false;
+ });
def(AST_SimpleStatement, function(){
return this.body.has_side_effects();
@@ -707,7 +714,8 @@ function Compressor(options, false_by_default) {
def(AST_Unary, function(){
return this.operator == "delete"
|| this.operator == "++"
- || this.operator == "--";
+ || this.operator == "--"
+ || this.expression.has_side_effects();
});
def(AST_SymbolRef, function(){ return false });
def(AST_Object, function(){
@@ -732,6 +740,10 @@ function Compressor(options, false_by_default) {
return this.expression.has_side_effects()
|| this.property.has_side_effects();
});
+ def(AST_Seq, function(){
+ return this.car.has_side_effects()
+ || this.cdr.has_side_effects();
+ });
})(function(node, func){
node.DEFMETHOD("has_side_effects", func);
});