enhance functions & reduce_vars (#5045)

This commit is contained in:
Alex Lam S.L
2021-07-03 23:19:08 +01:00
committed by GitHub
parent 668f96623c
commit 972b9f0bef
9 changed files with 288 additions and 162 deletions

View File

@@ -494,6 +494,41 @@ reduce_vars_3: {
node_version: ">=4"
}
reduce_lambda: {
options = {
evaluate: true,
functions: true,
reduce_vars: true,
toplevel: true,
unused: true,
}
input: {
"use strict";
let f = function() {
console.log(a, b);
};
let a = "foo", b = 42;
f();
b = "bar";
f();
}
expect: {
"use strict";
function f() {
console.log("foo", b);
}
let b = 42;
f();
b = "bar";
f();
}
expect_stdout: [
"foo 42",
"foo bar",
]
node_version: ">=4"
}
hoist_props: {
options = {
hoist_props: true,