fix corner case in inline (#5377)

fixes #5376
This commit is contained in:
Alex Lam S.L
2022-03-05 19:29:56 +00:00
committed by GitHub
parent e2b00814a8
commit 042c228c7b
2 changed files with 60 additions and 0 deletions

View File

@@ -8270,3 +8270,62 @@ issue_5366: {
"baz",
]
}
issue_5376_1: {
options = {
evaluate: true,
inline: true,
join_vars: true,
loops: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
"use strict";
var a;
for (;42;)
var b = function() {
var c;
throw new Error(c++);
}();
}
expect: {
"use strict";
for (;;) {
42;
throw new Error(NaN);
}
}
expect_stdout: Error("NaN")
}
issue_5376_2: {
options = {
evaluate: true,
inline: true,
join_vars: true,
loops: true,
side_effects: true,
toplevel: true,
unused: true,
}
input: {
"use strict";
var a;
for (;42;)
var b = function() {
var c;
c++;
throw new Error("PASS");
}();
}
expect: {
"use strict";
for (;;) {
0;
throw new Error("PASS");
}
}
expect_stdout: Error("PASS")
}