fix corner case in inline (#5848)

fixes #5844
This commit is contained in:
Alex Lam S.L 2024-06-17 06:38:16 +03:00 committed by GitHub
parent 87c9edbbc7
commit f31311e439
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

View File

@ -11162,6 +11162,10 @@ Compressor.prototype.compress = function(node) {
return; return;
} }
if (node instanceof AST_Class) return abort = true; 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 (node instanceof AST_Scope) return abort = true;
if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true; if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true;
if (node instanceof AST_SymbolRef) { if (node instanceof AST_SymbolRef) {

View File

@ -3937,3 +3937,25 @@ issue_5843_2: {
expect_stdout: "PASS" expect_stdout: "PASS"
node_version: ">=6" 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"
}