aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-09-25 10:32:14 +0300
committerMihai Bazon <mihai@bazon.net>2012-09-25 10:32:14 +0300
commitea6d1ea7014352ed81bf8d1fd461727d21ff4d12 (patch)
treecf5e95066cb8416709edf9cf4806a4dc21d747b0 /lib/compress.js
parent368ac8f93ca7ea704ee0eabd419cd083c6b843aa (diff)
downloadtracifyjs-ea6d1ea7014352ed81bf8d1fd461727d21ff4d12.tar.gz
tracifyjs-ea6d1ea7014352ed81bf8d1fd461727d21ff4d12.zip
it's not safe to assume that property access is side-effect-free
(getters/setters + various browser bugs will trigger side effects; also, an exception is thrown when the expression is undefined)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/compress.js b/lib/compress.js
index c6524e09..e7c01ac1 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -732,12 +732,15 @@ function Compressor(options, false_by_default) {
return true;
return false;
});
- def(AST_Dot, function(){
- return this.expression.has_side_effects();
- });
- def(AST_Sub, function(){
- return this.expression.has_side_effects()
- || this.property.has_side_effects();
+ // def(AST_Dot, function(){
+ // return this.expression.has_side_effects();
+ // });
+ // def(AST_Sub, function(){
+ // return this.expression.has_side_effects()
+ // || this.property.has_side_effects();
+ // });
+ def(AST_PropAccess, function(){
+ return true;
});
def(AST_Seq, function(){
return this.car.has_side_effects()
@@ -1405,9 +1408,9 @@ function Compressor(options, false_by_default) {
AST_Seq.DEFMETHOD("optimize", function(compressor){
var self = this;
- if (self.cdr instanceof AST_Seq)
- self.cdr = self.cdr.optimize(compressor);
if (compressor.option("cascade")) {
+ if (self.cdr instanceof AST_Seq)
+ self.cdr = self.cdr.optimize(compressor);
if (self.car instanceof AST_Assign
&& !self.car.left.has_side_effects()
&& self.car.left.equivalent_to(self.cdr)) {