Skip to content

disallow parameter substitution for named IIFEs#1596

Merged
alexlamsl merged 1 commit intomishoo:masterfrom
alexlamsl:issue-1595
Mar 10, 2017
Merged

disallow parameter substitution for named IIFEs#1596
alexlamsl merged 1 commit intomishoo:masterfrom
alexlamsl:issue-1595

Conversation

@alexlamsl
Copy link
Copy Markdown
Collaborator

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

@kzc
Copy link
Copy Markdown
Contributor

kzc commented Mar 10, 2017

Can you add this runnable test case that was failing with 2.8.11?

$ cat iife.js

(function iife(a, b, c) {
    console.log(a, b, c);
    if (a)
        iife(a - 1, b, c);
})(3, 4, 5);

$ bin/uglifyjs iife.js -c -b

WARN: Condition always true [iife.js:5,3]
!function iife(a, b, c) {
    console.log(3, 4, 5), iife(2, 4, 5);
}();

@alexlamsl
Copy link
Copy Markdown
Collaborator Author

FWIW, I used this PR to generate walk.min.js from #1595 and npm test now passes.

@kzc
Copy link
Copy Markdown
Contributor

kzc commented Mar 10, 2017

You mean npm test for https://github.com/yoshuawuyts/wayfarer ?

@alexlamsl
Copy link
Copy Markdown
Collaborator Author

@kzc
Copy link
Copy Markdown
Contributor

kzc commented Mar 10, 2017

This PR is low risk and should be released as soon as you can.

@kzc
Copy link
Copy Markdown
Contributor

kzc commented Mar 10, 2017

Would you mind changing the commit description to disallow parameter substitution for named IIFEs?

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 mishoo#1595
@alexlamsl alexlamsl changed the title fix IIFE variable substitution disallow parameter substitution for named IIFEs Mar 10, 2017
@alexlamsl alexlamsl merged commit d9344f3 into mishoo:master Mar 10, 2017
@alexlamsl alexlamsl deleted the issue-1595 branch March 10, 2017 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uglified wayfarer behaves differently from original

2 participants