docs(ast): fix comment of ClassElement::r#static#6731
docs(ast): fix comment of ClassElement::r#static#6731Boshen merged 3 commits intooxc-project:mainfrom
ClassElement::r#static#6731Conversation
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
|
|
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#staticClassElement::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.
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.
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.