From bf1d47180c87462b1605157eb15b31c9db2c1249 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Fri, 9 Feb 2018 01:52:39 +0800 Subject: fix `join_vars` on property accessors (#2895) fixes #2893 --- lib/compress.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/compress.js') 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 -- cgit v1.2.3