fix corner case in inline (#3822)

fixes #3821
This commit is contained in:
Alex Lam S.L
2020-04-26 20:31:19 +01:00
committed by GitHub
parent 36dcfa3e82
commit a4a8ccea8c
2 changed files with 52 additions and 2 deletions

View File

@@ -4062,3 +4062,49 @@ issue_3777_2: {
}
expect_stdout: "PASS"
}
issue_3821_1: {
options = {
inline: true,
}
input: {
var a = 0;
console.log(function(b) {
return +a + b;
}(--a));
}
expect: {
var a = 0;
console.log(function(b) {
return +a + b;
}(--a));
}
expect_stdout: "-2"
}
issue_3821_2: {
options = {
inline: true,
reduce_vars: true,
toplevel: true,
}
input: {
var a = "PASS";
function f(g, b) {
return g(), b;
}
console.log(f(function() {
a = "FAIL";
}, a));
}
expect: {
var a = "PASS";
function f(g, b) {
return g(), b;
}
console.log(f(function() {
a = "FAIL";
}, a));
}
expect_stdout: "PASS"
}