-
Notifications
You must be signed in to change notification settings - Fork 49.2k
[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
Conversation
[ghstack-poisoned]
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…alizers" [ghstack-poisoned]
for (42; i < 1; i += 1) {} | ||
for (bar(); i < 1; i += 1) {} | ||
for (; i < 1; i += 1) {} | ||
for (i = 0; i < 1; i += 1) {} |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
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. |
ghstack-source-id: 894914a Pull Request resolved: facebook/react#31712
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! |
Stack from ghstack (oldest at bottom):