return self.evaluate(compressor)[0];
});
+ function has_side_effects_or_prop_access(node, compressor) {
+ var save_pure_getters = compressor.option("pure_getters");
+ compressor.options.pure_getters = false;
+ var ret = node.has_side_effects(compressor);
+ compressor.options.pure_getters = save_pure_getters;
+ return ret;
+ }
+
AST_Binary.DEFMETHOD("lift_sequences", function(compressor){
if (compressor.option("sequences")) {
if (this.left instanceof AST_Seq) {
seq = AST_Seq.from_array(x).transform(compressor);
return seq;
}
+ if (this.right instanceof AST_Seq
+ && this instanceof AST_Assign
+ && !has_side_effects_or_prop_access(this.left, compressor)) {
+ var seq = this.right;
+ var x = seq.to_array();
+ this.right = x.pop();
+ x.push(this);
+ seq = AST_Seq.from_array(x).transform(compressor);
+ return seq;
+ }
}
return this;
});
lift_sequences_2: {
options = { sequences: true, evaluate: true };
input: {
- q = 1 + (foo(), bar(), 5) + 7 * (5 / (3 - (a(), (QW=ER), c(), 2))) - (x(), y(), 5);
+ foo.x = (foo = {}, 10);
+ bar = (bar = {}, 10);
}
expect: {
- foo(), bar(), a(), QW = ER, c(), x(), y(), q = 36
+ foo.x = (foo = {}, 10),
+ bar = {}, bar = 10;
}
}