aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-10-22 15:00:36 +0800
committerGitHub <noreply@github.com>2017-10-22 15:00:36 +0800
commit5fd723f14394b74f899e7b33bc9084317bf01d7d (patch)
tree4559e18e72cd6ed606eb66eb7215a3392dbc8d1c /lib
parent516eaef50c66aede72d3478a5653ae8651806258 (diff)
downloadtracifyjs-5fd723f14394b74f899e7b33bc9084317bf01d7d.tar.gz
tracifyjs-5fd723f14394b74f899e7b33bc9084317bf01d7d.zip
fix `unsafe` expansion of object literals (#2390)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6a40ef2a..8bc0e262 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4499,12 +4499,11 @@ merge(Compressor.prototype, {
for (var i = values.length; --i >= 0;) {
if (values[i].key === self.property) {
var value = values[i].value;
- if (value instanceof AST_Function ? !value.contains_this() : !value.has_side_effects(compressor)) {
- var obj = self.expression.clone();
- obj.properties = obj.properties.slice();
- obj.properties.splice(i, 1);
- return make_sequence(self, [ obj, value ]).optimize(compressor);
- }
+ if (value instanceof AST_Function ? value.contains_this() : value.has_side_effects(compressor)) break;
+ var obj = self.expression.clone();
+ obj.properties = obj.properties.slice();
+ obj.properties.splice(i, 1);
+ return make_sequence(self, [ obj, value ]).optimize(compressor);
}
}
}