aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 1be74033..a418925a 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -7861,11 +7861,13 @@ merge(Compressor.prototype, {
var prop = this.property;
if (expr.may_throw_on_access(compressor)) {
if (!this.optional) return this;
- prop = prop.drop_side_effect_free(compressor);
- if (!prop) return expr.drop_side_effect_free(compressor, first_in_statement);
- var node = this.clone();
- node.property = prop;
- return node;
+ if (prop.has_side_effects(compressor)) {
+ prop = prop.drop_side_effect_free(compressor);
+ if (!prop) return expr.drop_side_effect_free(compressor, first_in_statement);
+ var node = this.clone();
+ node.property = prop;
+ return node;
+ }
}
expr = expr.drop_side_effect_free(compressor, first_in_statement);
if (!expr) return prop.drop_side_effect_free(compressor, first_in_statement);