-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
docs(ast): fix comment of ClassElement::r#static
#6731
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
CodSpeed Performance ReportMerging #6731 will not alter performanceComparing Summary
|
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.
Thanks!
Wait, I just realized this comment was added later and it's wrong. |
Yeah it returns true for static properties. Static blocks aren't properties |
I've reverted the code change and updated the comment :) |
ClassElement::r#static
should return true
for static blockClassElement::r#static
ClassElement::r#static
ClassElement::r#static
/// Returns `true` if this [`ClassElement`] is a static block or has a | ||
/// Returns `true` if this [`ClassElement`] is a property and has a | ||
/// static modifier. |
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.
Sorry to be a pain, but I don't think this is quite right either, because this suggests it has to be a property, not a method.
I suggest let's clear this up for once and for all!
/// Returns `true` if this [`ClassElement`] has a static modifier.
///
/// Note: Class static blocks do not have a "modifier", as there is no non-static equivalent.
/// Therefore, returns `false` for static blocks.
///
/// The following all return `true`:
/// ```ts
/// class {
/// static prop = 1;
/// static method() {}
/// static #private = 2;
/// static #privateMethod() {}
/// static accessor accessorProp = 3;
/// static accessor #privateAccessorProp = 4;
/// }
/// ```
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'm too late. Merged while I was writing! Will make a follow-up PR.
Follow-up after #6731. Make a long comment to remove ambiguity about what this method does for once and for all!
The comment says:
Returns true if this ClassElement is a static block or has a static modifier.