fix corner case in inline

fixes #5735
This commit is contained in:
alexlamsl 2022-11-14 05:44:59 +08:00
parent e37a1489d4
commit a138436b86
2 changed files with 48 additions and 0 deletions

View File

@ -10948,6 +10948,7 @@ Compressor.prototype.compress = function(node) {
in_order = null;
return;
}
if (node instanceof AST_Class) return abort = true;
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) {

View File

@ -3927,3 +3927,50 @@ issue_5724: {
expect_stdout: ReferenceError("a is not defined")
node_version: ">=12"
}
issue_5735_1: {
options = {
inline: true,
}
input: {
console.log(typeof function(a) {
return class {
static P = { ...a };
};
}([ 42..p ] = []));
}
expect: {
console.log(typeof function(a) {
return class {
static P = { ...a };
};
}([ 42..p ] = []));
}
expect_stdout: "function"
node_version: ">=12"
}
issue_5735_2: {
options = {
inline: true,
}
input: {
console.log(typeof function(a) {
return class {
p = a;
};
}(console.log("PASS")));
}
expect: {
console.log(typeof function(a) {
return class {
p = a;
};
}(console.log("PASS")));
}
expect_stdout: [
"PASS",
"function",
]
node_version: ">=12"
}