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

[compiler] Allow sequence expressions in for loops, and prevent DCE of declarations when the variable is reassigned in a value block #31723

Open
wants to merge 1 commit into
base: gh/mvitousek/41/base
Choose a base branch
from

Conversation

mvitousek
Copy link
Contributor

@mvitousek mvitousek commented Dec 10, 2024

Stack from ghstack (oldest at bottom):

Summary:
Two somewhat unrelated fixes that combine to allow loops like for (i =1, j =1; ...) to be handled. We introduce a new case for building reactive functions when a block prior to a goto doesnt generate a value; this is the case for the fallthrough of sequence blocks in for loop inits, since the value is not read by anything.

We also make it so that we don't DCE declarations of variables that are written to in value blocks. If we did DCE such declarations, we would then later convert the reassignment to a const declaration--but declarations in value blocks are banned.

…f declarations when the variable is reassigned in a value block

Summary:
Two somewhat unrelated fixes that combine to allow loops like `for (i =1, j =1; ...)` to be handled. We introduce a new case for building reactive functions when a block prior to a goto doesnt generate a value; this is the case for the fallthrough of sequence blocks in for loop inits, since the value is not read by anything.

We also make it so that we don't DCE declarations of variables that are written to in value blocks. If we did DCE such declarations, we would then later convert the reassignment to a const declaration--but declarations in value blocks are banned.

[ghstack-poisoned]
Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 6:40pm

mvitousek added a commit that referenced this pull request Dec 10, 2024
…f declarations when the variable is reassigned in a value block

Summary:
Two somewhat unrelated fixes that combine to allow loops like `for (i =1, j =1; ...)` to be handled. We introduce a new case for building reactive functions when a block prior to a goto doesnt generate a value; this is the case for the fallthrough of sequence blocks in for loop inits, since the value is not read by anything.

We also make it so that we don't DCE declarations of variables that are written to in value blocks. If we did DCE such declarations, we would then later convert the reassignment to a const declaration--but declarations in value blocks are banned.

ghstack-source-id: 7468bc834141a4e73357eab2623ac811504d417c
Pull Request resolved: #31723
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants