fix corner case in unused (#4993)

fixes #4992
This commit is contained in:
Alex Lam S.L
2021-06-03 13:23:14 +01:00
committed by GitHub
parent dff7b48921
commit 83f7887e5d
2 changed files with 33 additions and 17 deletions

View File

@@ -973,9 +973,9 @@ issue_4681: {
}
expect: {
console.log(function(a) {
class A {
(class {
static p = a = this;
}
});
return typeof a;
}());
}
@@ -1399,9 +1399,9 @@ issue_4821_1: {
}
expect: {
var a;
class A {
(class {
static p = void (a = this);
}
});
console.log(typeof a);
}
expect_stdout: "function"
@@ -1725,3 +1725,26 @@ issue_4982_2: {
expect_stdout: "PASS"
node_version: ">=12"
}
issue_4992: {
options = {
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
class A {
static P = this;
get p() {}
}
console.log(typeof A.P);
}
expect: {
console.log(typeof class {
static P = this;
get p() {}
}.P);
}
expect_stdout: "function"
node_version: ">=12"
}