Skip to content

Commit

Permalink
fix corner case in inline (#5848)
Browse files Browse the repository at this point in the history
fixes #5844
  • Loading branch information
alexlamsl authored Jun 17, 2024
1 parent 87c9edb commit f31311e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -11162,6 +11162,10 @@ Compressor.prototype.compress = function(node) {
return;
}
if (node instanceof AST_Class) return abort = true;
if (node instanceof AST_Destructured) {
side_effects = true;
return;
}
if (node instanceof AST_Scope) return abort = true;
if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true;
if (node instanceof AST_SymbolRef) {
Expand Down
22 changes: 22 additions & 0 deletions test/compress/destructured.js
Original file line number Diff line number Diff line change
Expand Up @@ -3937,3 +3937,25 @@ issue_5843_2: {
expect_stdout: "PASS"
node_version: ">=6"
}

issue_5844: {
options = {
inline: true,
}
input: {
try {
(function(a) {
[ a.p ] = 42;
})(console.log("PASS"));
} catch (e) {}
}
expect: {
try {
(function(a) {
[ a.p ] = 42;
})(console.log("PASS"));
} catch (e) {}
}
expect_stdout: "PASS"
node_version: ">=6"
}

0 comments on commit f31311e

Please sign in to comment.