isReferenced is false for the left hand of AssignmentExpressions (revist #2557)
See original GitHub issueBug Report
- [ x ] I’d be open to it if you think this is worth looking into
Current Behavior I apologize if this is already being discussed elsewhere, but I’d like to revisit bug #2557. If I can paraphrase that bug, after traversing the following code:
let x = 0;
let y = 0;
x += 1;
y++;
the x
binding would not be considered referenced, while y
would.
If I’m understanding the purpose of referenced
correctly, I believe we would want these two behaviors (++
and +=
) to be consistent with each other.
In the JS Packager Parcel, they use this reference counter in their scope hoisting functionality, which causes incorrect tree shaking behavior for variables in +=
AssigmentExpressions. Bug.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Developers - isReferenced is false for the left hand of ...
isReferenced is false for the left hand of AssignmentExpressions (revist #2557)
Read more >SyntaxError: invalid assignment left-hand side - MDN Web Docs
The JavaScript exception "invalid assignment left-hand side" occurs when there was an unexpected assignment somewhere.
Read more >Boolean if statement has Invalid left-hand side in assignment ...
But I get a parsing error saying: Invalid left-hand side in assignment expression. Any ideas where I am going wrong?
Read more >PEP 572 – Assignment Expressions
Unparenthesized assignment expressions are prohibited at the top level of the right hand side of an assignment statement. Example:.
Read more >HANDBOOK OF MAGMA FUNCTIONS
resentations of a Lie algebra has been written by Dan Roozemond ... the xi are identifiers, and the right hand side expression must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is some logic behind this:
Would be great to get some feedback, but I guess this is per design and we’ll fix it in Parcel.
We have “references” that are “reads”, and “constantViolations” that are “writes”.
Maybe you are calling
replaceWith
on both identifiers?