fix corner case in collapse_vars (#5748)

fixes #5747
This commit is contained in:
Alex Lam S.L
2022-11-30 21:59:22 +02:00
committed by GitHub
parent 2352909c3d
commit 548f0938e8
3 changed files with 70 additions and 8 deletions

View File

@@ -1165,9 +1165,9 @@ collapse_rhs_static: {
"use strict";
var a = "FAIL";
class A {
static p = a = "PASS";
static p = "PASS";
}
console.log(a);
console.log(a = "PASS");
}
expect_stdout: "PASS"
node_version: ">=12"
@@ -3974,3 +3974,59 @@ issue_5735_2: {
]
node_version: ">=12"
}
issue_5747_1: {
options = {
collapse_vars: true,
}
input: {
"use strict";
(async function() {
var a = await 42;
class A {
static P = a && console.log(typeof this);
}
})();
}
expect: {
"use strict";
(async function() {
var a = await 42;
class A {
static P = a && console.log(typeof this);
}
})();
}
expect_stdout: "function"
node_version: ">=12"
}
issue_5747_2: {
options = {
collapse_vars: true,
}
input: {
"use strict";
(async function() {
var a = await 42;
class A {
static {
a && console.log(typeof this);
}
}
})();
}
expect: {
"use strict";
(async function() {
var a = await 42;
class A {
static {
a && console.log(typeof this);
}
}
})();
}
expect_stdout: "function"
node_version: ">=16"
}