fix corner cases in merge_vars (#5457)

fixes #5456
This commit is contained in:
Alex Lam S.L
2022-05-18 23:39:20 +01:00
committed by GitHub
parent 33c9c48318
commit 27aa85f84b
3 changed files with 89 additions and 5 deletions

View File

@@ -1748,8 +1748,8 @@ issue_4454_2: {
expect: {
function f(a) {
(async function(c = console.log(a)) {})();
var a = 42..toString();
console.log(a);
var b = 42..toString();
console.log(b);
}
f("PASS");
}
@@ -2959,3 +2959,45 @@ issue_5305_3: {
expect_stdout: "PASS"
node_version: ">=8"
}
issue_5456: {
options = {
inline: true,
merge_vars: true,
}
input: {
var a = true;
(function() {
(function(b, c) {
var d = async function() {
c = await null;
}();
var e = function() {
if (c)
console.log(typeof d);
while (b);
}();
})(function(i) {
return console.log("foo") && i;
}(a));
})();
}
expect: {
var a = true;
(function() {
b = (i = a, console.log("foo") && i),
i = async function() {
c = await null;
}(),
e = function() {
if (c) console.log(typeof i);
while (b);
}(),
void 0;
var b, c, i, e;
var i;
})();
}
expect_stdout: "foo"
node_version: ">=8"
}