fix corner case in rests (#5109)

fixes #5108
This commit is contained in:
Alex Lam S.L
2021-08-09 01:59:33 +01:00
committed by GitHub
parent fdcc6d3a9c
commit c09f63aefb
2 changed files with 26 additions and 2 deletions

View File

@@ -12313,8 +12313,10 @@ merge(Compressor.prototype, {
OPT(AST_DestructuredArray, function(self, compressor) {
if (compressor.option("rests") && self.rest instanceof AST_DestructuredArray) {
self.elements = self.elements.concat(self.rest.elements);
self.rest = self.rest.rest;
return make_node(AST_DestructuredArray, self, {
elements: self.elements.concat(self.rest.elements),
rest: self.rest.rest,
});
}
return self;
});