aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-12-11 22:45:59 +0000
committerGitHub <noreply@github.com>2020-12-12 06:45:59 +0800
commitfd0d28e4652b8709d41031ef94594a50266f7c01 (patch)
treea00efbbb387ad536b55041da790903c9658e51c0 /lib
parent2123f38394d4c98fcb4acdc0378ffd86fd9bec9a (diff)
downloadtracifyjs-fd0d28e4652b8709d41031ef94594a50266f7c01.tar.gz
tracifyjs-fd0d28e4652b8709d41031ef94594a50266f7c01.zip
fix corner case in `spread` (#4370)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/compress.js b/lib/compress.js
index cc601bfb..96589686 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -10051,13 +10051,14 @@ 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_ObjectSetter && prop.key instanceof AST_Node
- || prop instanceof AST_Spread);
+ return !(prop instanceof AST_ObjectGetter || prop instanceof AST_Spread);
})) {
changed = true;
exp.properties.forEach(function(prop) {
- if (prop instanceof AST_ObjectKeyVal) process(prop);
+ process(prop instanceof AST_ObjectSetter ? make_node(AST_ObjectKeyVal, prop, {
+ key: prop.key,
+ value: make_node(AST_Undefined, prop).optimize(compressor)
+ }) : prop);
});
} else {
generated = true;