Skip to content

[compiler] Implement support for non-declaration for initializers #31712

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

Closed
wants to merge 2 commits into from

Conversation

mvitousek
Copy link
Contributor

@mvitousek mvitousek commented Dec 9, 2024

Copy link

vercel bot commented Dec 9, 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:39pm

for (42; i < 1; i += 1) {}
for (bar(); i < 1; i += 1) {}
for (; i < 1; i += 1) {}
for (i = 0; i < 1; i += 1) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's test a more complex initializer value, like a logical expression, ternary, sequence expression, or optional.

@@ -1354,6 +1354,8 @@ function codegenForInit(
init: ReactiveValue,
): t.Expression | t.VariableDeclaration | null {
if (init.kind === 'SequenceExpression') {
// We may end up emitti
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: looks cut off

* emit as an expression instead
*/
cx.temp = temp;
return codegenInstructionValueToExpression(cx, init);
Copy link
Member

@josephsavona josephsavona Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this skip over remaining instructions? since it's exiting the loop and function

Copy link
Member

@josephsavona josephsavona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good but i'm worried about expressions that are more complex, see comments.

Copy link

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Mar 16, 2025
Testmasha pushed a commit to Testmasha/Test that referenced this pull request Apr 15, 2025
Copy link

github-actions bot commented Jun 7, 2025

Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

@github-actions github-actions bot closed this Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants