-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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] Implement support for non-declaration for initializers #31712
base: gh/mvitousek/40/base
Are you sure you want to change the base?
Conversation
[ghstack-poisoned]
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ghstack-source-id: 894914ab8c31b8b308cac05b07a0cc351419346e Pull Request resolved: #31712
…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.
Stack from ghstack (oldest at bottom):