Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly add variable declarations for IIFE loop assignees #1094

Conversation

alangpierce
Copy link
Member

Fixes #750

The solution here is similar in spirit to #639, but has some differences.
Rather than allowing the loop to become an IIFE and letting
add-variable-declarations put in the declaration for us, we now explicitly add
declarations for any index/value bindings that we know will be in IIFEs, as long
as there is at least one usage of the variable outside of the loop. This
required a lot of coordination between BlockPatcher and all of its descendant
ForPatchers during initialize so that patching can be done in the proper order.

Fixes decaffeinate#750

The solution here is similar in spirit to decaffeinate#639, but has some differences.
Rather than allowing the loop to become an IIFE and letting
add-variable-declarations put in the declaration for us, we now explicitly add
declarations for any index/value bindings that we know will be in IIFEs, as long
as there is at least one usage of the variable outside of the loop. This
required a lot of coordination between BlockPatcher and all of its descendant
ForPatchers during initialize so that patching can be done in the proper order.
@alangpierce alangpierce merged commit 03a9245 into decaffeinate:master Jun 19, 2017
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.

1 participant