Skip to content

Commit 1d400f1

Browse files
authoredNov 14, 2022
fix corner case in inline (#5736)
fixes #5735
1 parent 7f424a5 commit 1d400f1

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed
 

‎lib/compress.js

+1
Original file line numberDiff line numberDiff line change
@@ -10948,6 +10948,7 @@ Compressor.prototype.compress = function(node) {
1094810948
in_order = null;
1094910949
return;
1095010950
}
10951+
if (node instanceof AST_Class) return abort = true;
1095110952
if (node instanceof AST_Scope) return abort = true;
1095210953
if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true;
1095310954
if (node instanceof AST_SymbolRef) {

‎test/compress/classes.js

+47
Original file line numberDiff line numberDiff line change
@@ -3927,3 +3927,50 @@ issue_5724: {
39273927
expect_stdout: ReferenceError("a is not defined")
39283928
node_version: ">=12"
39293929
}
3930+
3931+
issue_5735_1: {
3932+
options = {
3933+
inline: true,
3934+
}
3935+
input: {
3936+
console.log(typeof function(a) {
3937+
return class {
3938+
static P = { ...a };
3939+
};
3940+
}([ 42..p ] = []));
3941+
}
3942+
expect: {
3943+
console.log(typeof function(a) {
3944+
return class {
3945+
static P = { ...a };
3946+
};
3947+
}([ 42..p ] = []));
3948+
}
3949+
expect_stdout: "function"
3950+
node_version: ">=12"
3951+
}
3952+
3953+
issue_5735_2: {
3954+
options = {
3955+
inline: true,
3956+
}
3957+
input: {
3958+
console.log(typeof function(a) {
3959+
return class {
3960+
p = a;
3961+
};
3962+
}(console.log("PASS")));
3963+
}
3964+
expect: {
3965+
console.log(typeof function(a) {
3966+
return class {
3967+
p = a;
3968+
};
3969+
}(console.log("PASS")));
3970+
}
3971+
expect_stdout: [
3972+
"PASS",
3973+
"function",
3974+
]
3975+
node_version: ">=12"
3976+
}

0 commit comments

Comments
 (0)
Please sign in to comment.