fix AST corruption during inline of simple return (#3056)

fixes #3054
This commit is contained in:
Alex Lam S.L
2018-04-06 05:39:07 +08:00
committed by GitHub
parent b5bab254ce
commit 44116c6d2b
2 changed files with 36 additions and 1 deletions

View File

@@ -2237,3 +2237,33 @@ issue_3018: {
}
expect_stdout: "PASS"
}
issue_3054: {
options = {
booleans: true,
collapse_vars: true,
inline: 1,
reduce_vars: true,
toplevel: true,
}
input: {
"use strict";
function f() {
return { a: true };
}
console.log(function(b) {
b = false;
return f();
}().a, f.call().a);
}
expect: {
"use strict";
function f() {
return { a: !0 };
}
console.log(function(b) {
return { a: !(b = !1) };
}().a, f.call().a);
}
expect_stdout: "true true"
}