From: Alex Lam S.L Date: Fri, 11 Dec 2020 18:19:11 +0000 (+0000) Subject: fix corner case in `spread` (#4364) X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=1020d3725612b7e1225765e698138570172c841a;p=UglifyJS.git fix corner case in `spread` (#4364) fixes #4363 --- diff --git a/lib/compress.js b/lib/compress.js index 1862fd10..27b080bb 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -10051,7 +10051,9 @@ merge(Compressor.prototype, { found = true; var exp = prop.expression; if (compressor.option("spread") && exp instanceof AST_Object && all(exp.properties, function(prop) { - return !(prop instanceof AST_ObjectGetter || prop instanceof AST_Spread); + return !(prop instanceof AST_ObjectGetter + || prop instanceof AST_ObjectSetter && prop.key instanceof AST_Node + || prop instanceof AST_Spread); })) { changed = true; exp.properties.forEach(function(prop) { diff --git a/test/compress/spread.js b/test/compress/spread.js index 8af7bffb..78348758 100644 --- a/test/compress/spread.js +++ b/test/compress/spread.js @@ -758,3 +758,26 @@ issue_4361: { ] node_version: ">=8" } + +issue_4363: { + options = { + objects: true, + spread: true, + } + input: { + ({ + ...{ + set [console.log("PASS")](v) {}, + }, + }); + } + expect: { + ({ + ...{ + set [console.log("PASS")](v) {}, + }, + }); + } + expect_stdout: "PASS" + node_version: ">=8" +}