-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix(es/fixer): Wrap in
expr in for-in head
#9209
Conversation
CodSpeed Performance ReportMerging #9209 will not alter performanceComparing Summary
|
@@ -0,0 +1,72 @@ | |||
for(var a = (b in c) in {}); | |||
for(var a = 1 || (b in c) in {}); | |||
for(var a = 1 + (2 || (b in c)) in {}); |
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.
We have some false positives. It is no longer necessary to add parentheses around the in
expression that is already in parentheses.
We need to check the in
expressions from the outside in. But currently, the wrap
calls are from the inside out, which cannot be completed in a single pass.
Do you have any thoughts? @kdy1
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.
Can we proceed with some false positives for now and refactor them outside? If you prefer, rewriting the fixer to work outside in is also fine.
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.
I plan to leave a TODO for now, as this is a very rare edge case and has no negative impact.
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.
swc-bump:
- swc_ecma_transforms_base
- swc_core
in
expr in for-in headin
expr in for-in head
Related issue (if exists):