fix corner case in inline (#5736)

fixes #5735
This commit is contained in:
Alex Lam S.L
2022-11-14 02:35:26 +00:00
committed by GitHub
parent 7f424a55c5
commit 1d400f1a25
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"
}