Skip to content

Commit f31311e

Browse files
authored
fix corner case in inline (#5848)
fixes #5844
1 parent 87c9edb commit f31311e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/compress.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11162,6 +11162,10 @@ Compressor.prototype.compress = function(node) {
1116211162
return;
1116311163
}
1116411164
if (node instanceof AST_Class) return abort = true;
11165+
if (node instanceof AST_Destructured) {
11166+
side_effects = true;
11167+
return;
11168+
}
1116511169
if (node instanceof AST_Scope) return abort = true;
1116611170
if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true;
1116711171
if (node instanceof AST_SymbolRef) {

test/compress/destructured.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3937,3 +3937,25 @@ issue_5843_2: {
39373937
expect_stdout: "PASS"
39383938
node_version: ">=6"
39393939
}
3940+
3941+
issue_5844: {
3942+
options = {
3943+
inline: true,
3944+
}
3945+
input: {
3946+
try {
3947+
(function(a) {
3948+
[ a.p ] = 42;
3949+
})(console.log("PASS"));
3950+
} catch (e) {}
3951+
}
3952+
expect: {
3953+
try {
3954+
(function(a) {
3955+
[ a.p ] = 42;
3956+
})(console.log("PASS"));
3957+
} catch (e) {}
3958+
}
3959+
expect_stdout: "PASS"
3960+
node_version: ">=6"
3961+
}

0 commit comments

Comments
 (0)