disallow parameter substitution for named IIFEs (#1596)

Self-referenced function has non-fixed values assigned to its parameters.

Let `unused` & `!keep_fnames` do the scanning, then apply `reduce_vars` only to unnamed functions.

fixes #1595
This commit is contained in:
Alex Lam S.L
2017-03-11 03:34:55 +08:00
committed by GitHub
parent be80f7e706
commit d9344f30b8
2 changed files with 76 additions and 0 deletions

View File

@@ -279,6 +279,7 @@ merge(Compressor.prototype, {
}
var iife;
if (node instanceof AST_Function
&& !node.name
&& (iife = tw.parent()) instanceof AST_Call
&& iife.expression === node) {
// Virtually turn IIFE parameters into variable definitions: