-
Notifications
You must be signed in to change notification settings - Fork 49.7k
[compiler] patch: retain UpdateExpression for globals #30471
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 ↗︎
|
[ghstack-poisoned]
| loc: exprLoc, | ||
| }); | ||
| return {kind: 'LoadLocal', place: identifier, loc: exprLoc}; | ||
| const binding = builder.resolveIdentifier(leftExpr); |
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 is the key change: we check if the identifier is a local (or non-local) binding
| const identifier = lowerIdentifier(builder, leftExpr); | ||
| const kind = getStoreKind(builder, leftExpr); | ||
| if (kind === 'StoreLocal') { | ||
| lowerValueToTemporary(builder, { | ||
| kind: 'StoreLocal', | ||
| lvalue: { | ||
| place: {...identifier}, | ||
| kind: InstructionKind.Reassign, | ||
| }, | ||
| value: {...binaryPlace}, | ||
| type: null, | ||
| loc: exprLoc, | ||
| }); | ||
| return {kind: 'LoadLocal', place: identifier, loc: exprLoc}; | ||
| } else { | ||
| lowerValueToTemporary(builder, { | ||
| kind: 'StoreContext', | ||
| lvalue: { | ||
| place: {...identifier}, | ||
| kind: InstructionKind.Reassign, | ||
| }, | ||
| value: {...binaryPlace}, | ||
| loc: exprLoc, | ||
| }); | ||
| return {kind: 'LoadContext', place: identifier, 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.
(Only whitespace changes here)
[ghstack-poisoned]
Stack from ghstack (oldest at bottom):