Referencing a global is assumed to have side effects.

Close #550
This commit is contained in:
Mihai Bazon
2014-09-28 11:16:51 +03:00
parent f0c1a01bc2
commit 01d19b4b52
3 changed files with 30 additions and 1 deletions

View File

@@ -897,7 +897,9 @@ merge(Compressor.prototype, {
|| this.operator == "--"
|| this.expression.has_side_effects(compressor);
});
def(AST_SymbolRef, function(compressor){ return false });
def(AST_SymbolRef, function(compressor){
return this.global() && this.undeclared();
});
def(AST_Object, function(compressor){
for (var i = this.properties.length; --i >= 0;)
if (this.properties[i].has_side_effects(compressor))