inline single-use functions that are not constant expressions (#2434)

fixes #2428
This commit is contained in:
Alex Lam S.L
2017-11-05 22:14:11 +08:00
committed by GitHub
parent f46281e2b7
commit 2c2fd89e34
3 changed files with 45 additions and 23 deletions

View File

@@ -508,3 +508,41 @@ issue_2114_2: {
}
expect_stdout: "2"
}
issue_2428: {
options = {
collapse_vars: true,
inline: true,
passes: 2,
pure_getters: "strict",
reduce_vars: true,
side_effects: true,
toplevel: true,
unsafe: true,
unused: true,
}
input: {
function bar(k) {
console.log(k);
}
function foo(x) {
return bar(x);
}
function baz(a) {
foo(a);
}
baz(42);
baz("PASS");
}
expect: {
function baz(a) {
console.log(a);
}
baz(42);
baz("PASS");
}
expect_stdout: [
"42",
"PASS",
]
}