-
Notifications
You must be signed in to change notification settings - Fork 47k
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] Support for member expression inc/decrement #30697
Conversation
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. [ghstack-poisoned]
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. ghstack-source-id: 9009bc1eb53565cebe66152956184df70036b02a Pull Request resolved: #30697
return { | ||
kind: 'LoadLocal', | ||
place: expr.node.prefix | ||
? {...newValuePlace} | ||
: {...previousValuePlace}, | ||
loc: exprLoc, | ||
}; |
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.
This should be fine, but we try to avoid using lvalues more than once. The main exception is for method calls, where we evaluate the receiver to an lvalue, then use that lvalue to load the property for the method and again as the receiver of the method call instruction.
To test, can you add some fixtures where the increment/decrement is used as an rvalue? let x = obj.x++
and (obj.x++).toString()
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.
Awesome! Please see comments before landing with some additional things to test
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. [ghstack-poisoned]
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. ghstack-source-id: 8f3979913aad561cdba70464c3cc5f0ee95887b5 Pull Request resolved: #30697
Test Plan: Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression. ghstack-source-id: 8f3979913aad561cdba70464c3cc5f0ee95887b5 Pull Request resolved: #30697
Stack from ghstack (oldest at bottom):
Test Plan:
Builds support for a.x++ and friends. Similar to a.x += y, emits it as an assignment expression.