Skip to content

Provide special property assignment symbol only for left-hand side of assignment #14302

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

Merged
merged 2 commits into from
Feb 24, 2017

Conversation

sandersn
Copy link
Member

In a Javascript file, the binder assigns a SpecialPropertyAssignment marker to the BinaryExpression node of several kinds of special assignments. Then it binds a special symbol whose declaration is that BinaryExpression node. But the symbol only applies to the left-hand side of the assignment. The right-hand side is an independent expression that should have its own symbols.

Previously, symbol lookup in the checker didn't check whether a Javascript node that was part of a special property assignment came from the lhs or the rhs. So the right-hand side would also incorrectly get the special symbol intended for the left-hand side.

getSpecialPropertyAssignmentSymbolFromEntityName in the checker now checks that its argument is the left-hand side of an assignment before returning a special property assignment symbol.

Fixes #14278

In a Javascript file, the binder assigns a SpecialPropertyAssignment
marker to the BinaryExpression node of several kinds of special
assignments. Then it binds a special symbol whose declaration is that
BinaryExpression node. But the symbol only applies to the left-hand side
of the assignment. The right-hand side is an independent expression that
should have its own symbols.

Previously, symbol lookup in the checker didn't check whether a
Javascript node that was part of a special property assignment came from
the lhs or the rhs. So the right-hand side would also incorrectly get
the special symbol intended for the left-hand side.

`getSpecialPropertyAssignmentSymbolFromEntityName` in the checker now
checks that its argument is the left-hand side of an assignment before
returning a special property assignment symbol.
Copy link
Contributor

@mhegazy mhegazy left a comment

Choose a reason for hiding this comment

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

Thanks!

@sandersn sandersn merged commit 5b23dbc into master Feb 24, 2017
@sandersn sandersn deleted the make-special-property-assignment-apply-only-to-lhs branch February 24, 2017 23:14
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants