-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Bail on sharing comments with siblings if key is a string #5007
Conversation
existentialism
commented
Dec 15, 2016
•
edited
Loading
edited
Q | A |
---|---|
Patch: Bug Fix? | Y |
Major: Breaking Change? | N |
Minor: New Feature? | N |
Deprecations? | N |
Spec Compliancy? | N |
Tests Added/Pass? | Y/Y |
Fixed Tickets | Fixes #4995 |
License | MIT |
Doc PR | |
Dependency Changes |
@@ -0,0 +1,4 @@ | |||
myLabel: //woops | |||
for (let a of {}) { |
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.
{}
isn't valid anyway so it should be anything else like b
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.
If we wanted to test validity then could make an exec.js test, but yeah this is just b/c of the comment
Current coverage is 89.10% (diff: 100%)
|
@@ -5,6 +5,9 @@ | |||
*/ | |||
|
|||
export function shareCommentsWithSiblings() { | |||
// NOTE: this assumes numbered keys | |||
if (typeof this.key === "string") return; |
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 wonder what value does the key
get in a LabeledStatement
... or does the sharing happen from the ForOfStatement
side? That would be bad 😆
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.
the key is basically the position in Program
or a BlockStatement
via an integer but if it's part of another node it's just the property name of the key (so for for-of it's like left, right, body). For a LabeledStatement
its an integer too.