mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
docs(ast): fix comment for ClassElement::r#static (#6771)
Follow-up after #6731. Make a long comment to remove ambiguity about what this method does for once and for all!
This commit is contained in:
parent
e15b7ce09c
commit
91651e0a3b
1 changed files with 16 additions and 2 deletions
|
|
@ -1344,8 +1344,22 @@ impl<'a> ClassElement<'a> {
|
||||||
matches!(self, Self::StaticBlock(_))
|
matches!(self, Self::StaticBlock(_))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if this [`ClassElement`] is a property and has a
|
/// Returns `true` if this [`ClassElement`] has a static modifier.
|
||||||
/// 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;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
pub fn r#static(&self) -> bool {
|
pub fn r#static(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::TSIndexSignature(_) | Self::StaticBlock(_) => false,
|
Self::TSIndexSignature(_) | Self::StaticBlock(_) => false,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue