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

For loop rework chapter 1 #7365

Merged
merged 8 commits into from
Aug 25, 2018
Merged

Conversation

Simn
Copy link
Member

@Simn Simn commented Aug 25, 2018

This PR changes how we deal with for loop typing by turning it into a two-step approach:

  1. Determine the iterator kind and the type of whatever we're iterating over (of_texpr).
  2. Use the iterator kind to generate the optimized output code (to_texpr).

We have to determine the type of the thing we're iterating over in order to properly declare the iteration variable, which we need in order to type the loop body. However, we do not necessarily have to do the actual optimization right away and there are cases where delaying it leads to better code generation.

For the time being, we still do step 2 right away. I have already tried the delay and it passes the unit tests, but I'm holding back on this change because I think that it leads to some duplicate typing. Once we get that right, it will address #3663.

What it does right now:

This comes with some temp var name changes, so diffs are a bit messy. Other than that, unit.js looks as expected.

@Simn Simn merged commit 119ba53 into HaxeFoundation:development Aug 25, 2018
@Simn Simn deleted the for_loop_rework branch August 25, 2018 11:56
@skial skial mentioned this pull request Sep 3, 2018
1 task
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