fix corner case in templates (#4677)

fixes #4676
This commit is contained in:
Alex Lam S.L
2021-02-22 15:59:28 +00:00
committed by GitHub
parent f9a2a9d78e
commit e535f19189
2 changed files with 38 additions and 2 deletions

View File

@@ -298,3 +298,33 @@ issue_4630: {
expect_stdout: "/PASS/"
node_version: ">=4"
}
issue_4676: {
options = {
evaluate: true,
reduce_vars: true,
templates: true,
toplevel: true,
unsafe:true,
unused: true,
}
input: {
function f(a) {
var b = `foo${a = "PASS"}`;
for (var c in f && b)
b.p;
return a;
}
console.log(f("FAIL"));
}
expect: {
console.log(function f(a) {
var b = "fooPASS";
for (var c in f, b)
b.p;
return "PASS";
}());
}
expect_stdout: "PASS"
node_version: ">=4"
}