fix & improve function argument compression (#1584)

- one-use function call => IIFE should take `eval()` & `arguments` into account
- if unused parameter cannot be eliminated, replace it with `0`

fixes #1583
This commit is contained in:
Alex Lam S.L
2017-03-09 19:11:05 +08:00
committed by GitHub
parent e9920f7ca1
commit b633706ce4
3 changed files with 171 additions and 13 deletions

View File

@@ -761,3 +761,33 @@ assign_chain: {
}
}
}
issue_1583: {
options = {
keep_fargs: true,
reduce_vars: true,
unused: true,
}
input: {
function m(t) {
(function(e) {
t = e();
})(function() {
return (function(a) {
return a;
})(function(a) {});
});
}
}
expect: {
function m(t) {
(function(e) {
t = (function() {
return (function(a) {
return a;
})(function(a) {});
})();
})();
}
}
}