fix corner case in side_effects (#5383)

fixes #5382
This commit is contained in:
Alex Lam S.L
2022-03-12 06:14:30 +00:00
committed by GitHub
parent 01b84074d7
commit 46570a4eb6
2 changed files with 28 additions and 1 deletions

View File

@@ -5426,7 +5426,6 @@ Compressor.prototype.compress = function(node) {
return !(prop instanceof AST_ObjectGetter || prop instanceof AST_Spread);
});
});
def(AST_ObjectIdentity, return_true);
def(AST_Sequence, function() {
return this.tail_node().safe_to_spread();
});

View File

@@ -1166,3 +1166,31 @@ issue_5006: {
expect_stdout: "PASS"
node_version: ">=6"
}
issue_5382: {
options = {
side_effects: true,
}
input: {
({
f() {
({ ...this });
},
get p() {
console.log("PASS");
},
}).f();
}
expect: {
({
f() {
({ ...this });
},
get p() {
console.log("PASS");
},
}).f();
}
expect_stdout: "PASS"
node_version: ">=8.3.0"
}