aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-09 01:52:39 +0800
committerGitHub <noreply@github.com>2018-02-09 01:52:39 +0800
commitbf1d47180c87462b1605157eb15b31c9db2c1249 (patch)
tree09b4c30e0ff396446f51e5cc9637ab07e8248a1a /lib/compress.js
parent0cfbd79aa123a97c94c1bf5032acf11c15886dad (diff)
downloadtracifyjs-bf1d47180c87462b1605157eb15b31c9db2c1249.tar.gz
tracifyjs-bf1d47180c87462b1605157eb15b31c9db2c1249.zip
fix `join_vars` on property accessors (#2895)
fixes #2893
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/compress.js b/lib/compress.js
index dc453f14..e70af436 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1816,11 +1816,12 @@ merge(Compressor.prototype, {
}
if (prop instanceof AST_Node) break;
prop = "" + prop;
- if (compressor.has_directive("use strict")) {
- if (!all(def.value.properties, function(node) {
- return node.key != prop && node.key.name != prop;
- })) break;
- }
+ var diff = compressor.has_directive("use strict") ? function(node) {
+ return node.key != prop && node.key.name != prop;
+ } : function(node) {
+ return node.key.name != prop;
+ };
+ if (!all(def.value.properties, diff)) break;
def.value.properties.push(make_node(AST_ObjectKeyVal, node, {
key: prop,
value: node.right