diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index f0f864b9699d6..0211ba05a7c58 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -225,7 +225,7 @@ pub struct IdentifierName<'a> { /// `x` inside `func` in `const x = 0; function func() { console.log(x); }` /// -/// Represents an identifier reference, which is a reference to a variable, function, class, or object. +/// Represents an identifier reference. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -251,8 +251,7 @@ pub struct IdentifierReference<'a> { /// `x` in `const x = 0;` /// -/// Represents a binding identifier, which is an identifier that is used to declare a variable, -/// function, class, or object. +/// Represents a binding identifier. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) /// @@ -281,7 +280,7 @@ pub struct BindingIdentifier<'a> { /// `loop` in `loop: while (true) { break loop; }` /// -/// Represents a label identifier, which is an identifier that is used to label a statement. +/// Represents a label identifier. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -343,7 +342,7 @@ pub enum ArrayExpressionElement<'a> { /// empty slot in `const array = [1, , 2];` /// -/// Array Expression Elision Element +/// Array expression elision element #[ast(visit)] #[derive(Debug, Clone)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -394,7 +393,7 @@ pub struct ObjectProperty<'a> { } inherit_variants! { -/// Property Key +/// Property key /// /// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -679,7 +678,7 @@ pub struct UpdateExpression<'a> { /// `typeof` in `typeof a === "string"` /// -/// Represents a unary expression, which includes an operator and an argument. +/// Represents a unary expression. /// The following syntaxes are supported: `+a`, `-a`, `~a`, `!a`, `delete a`, `void a`, `typeof a`. #[ast(visit)] #[derive(Debug)] @@ -717,7 +716,7 @@ pub struct PrivateInExpression<'a> { /// `||` in `const foo = bar || 2;` /// -/// Represents a logical expression, which includes a left expression, an operator, and a right expression. +/// Represents a logical expression. /// The following syntaxes are supported: `||`, `&&` and `??`. #[ast(visit)] #[derive(Debug)] @@ -731,7 +730,7 @@ pub struct LogicalExpression<'a> { /// `bar ? 1 : 2` in `const foo = bar ? 1 : 2;` /// -/// Represents a conditional expression, which includes a test, a consequent, and an alternate. +/// Represents a conditional expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -744,7 +743,7 @@ pub struct ConditionalExpression<'a> { /// `foo = 1` in `let foo; foo = 1;` /// -/// Represents an assignment expression, which includes an operator, a target, and an expression. +/// Represents an assignment expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -756,7 +755,7 @@ pub struct AssignmentExpression<'a> { } inherit_variants! { -/// Destructuring Assignment +/// Destructuring assignment /// /// Inherits variants from [`SimpleAssignmentTarget`] and [`AssignmentTargetPattern`]. /// See [`ast` module docs] for explanation of inheritance. @@ -774,7 +773,7 @@ pub enum AssignmentTarget<'a> { } inherit_variants! { -/// Simple Assignment Target +/// Simple assignment target /// /// Inherits variants from [`MemberExpression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -900,7 +899,7 @@ pub struct AssignmentTargetRest<'a> { } inherit_variants! { -/// Assignment Target Maybe Default +/// Assignment target maybe default /// /// Inherits variants from [`AssignmentTarget`]. See [`ast` module docs] for explanation of inheritance. /// @@ -941,8 +940,7 @@ pub enum AssignmentTargetProperty<'a> { /// `foo` in `({ foo } = obj);` /// -/// Represents an assignment target property identifier, which includes a binding, -/// and an optional init expression. +/// Represents an assignment target property identifier. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -961,7 +959,7 @@ pub struct AssignmentTargetPropertyIdentifier<'a> { /// `foo: bar` in `({ foo: bar } = obj);` /// -/// Represents an assignment target property property, which includes a name and a binding. +/// Represents an assignment target property property. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1034,7 +1032,7 @@ pub struct ChainExpression<'a> { } inherit_variants! { -/// Chain Element +/// Chain element /// /// Inherits variants from [`MemberExpression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -1138,7 +1136,7 @@ pub struct BlockStatement<'a> { pub scope_id: Cell>, } -/// Declarations and the Variable Statement +/// Declarations and the `VariableStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] @@ -1197,7 +1195,7 @@ pub enum VariableDeclarationKind { AwaitUsing = 4, } -/// A single variable declaration in a list of [variable declarations](VariableDeclaration). +/// A single variable declaration in a list of [`VariableDeclaration`]s. /// /// ## Examples /// ```ts @@ -1218,7 +1216,7 @@ pub struct VariableDeclarator<'a> { pub definite: bool, } -/// Empty Statement +/// `EmptyStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1226,7 +1224,7 @@ pub struct EmptyStatement { pub span: Span, } -/// Expression Statement +/// `ExpressionStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1236,7 +1234,7 @@ pub struct ExpressionStatement<'a> { pub expression: Expression<'a>, } -/// If Statement +/// `IfStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1257,7 +1255,7 @@ pub struct DoWhileStatement<'a> { pub test: Expression<'a>, } -/// While Statement +/// `WhileStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1267,7 +1265,7 @@ pub struct WhileStatement<'a> { pub body: Statement<'a>, } -/// For Statement +/// `ForStatement` #[ast(visit)] #[scope] #[derive(Debug)] @@ -1282,7 +1280,7 @@ pub struct ForStatement<'a> { } inherit_variants! { -/// For Statement Init +/// `ForStatementInit` /// /// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -1311,7 +1309,7 @@ pub struct ForInStatement<'a> { } inherit_variants! { -/// For Statement Left +/// `ForStatementLeft` /// /// Inherits variants from [`AssignmentTarget`]. See [`ast` module docs] for explanation of inheritance. /// @@ -1340,7 +1338,7 @@ pub struct ForOfStatement<'a> { pub scope_id: Cell>, } -/// Continue Statement +/// `ContinueStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1349,7 +1347,7 @@ pub struct ContinueStatement<'a> { pub label: Option>, } -/// Break Statement +/// `BreakStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1358,7 +1356,7 @@ pub struct BreakStatement<'a> { pub label: Option>, } -/// Return Statement +/// `ReturnStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1367,7 +1365,7 @@ pub struct ReturnStatement<'a> { pub argument: Option>, } -/// With Statement +/// `WithStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1377,7 +1375,7 @@ pub struct WithStatement<'a> { pub body: Statement<'a>, } -/// Switch Statement +/// `SwitchStatement` #[ast(visit)] #[scope] #[derive(Debug)] @@ -1399,7 +1397,7 @@ pub struct SwitchCase<'a> { pub consequent: Vec<'a, Statement<'a>>, } -/// Labelled Statement +/// `LabeledStatement` #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1409,7 +1407,7 @@ pub struct LabeledStatement<'a> { pub body: Statement<'a>, } -/// Throw Statement +/// `ThrowStatement` /// /// # Example /// ```ts @@ -1425,7 +1423,7 @@ pub struct ThrowStatement<'a> { pub argument: Expression<'a>, } -/// Try Statement +/// `TryStatement` /// /// # Example /// ```ts @@ -1453,7 +1451,7 @@ pub struct TryStatement<'a> { pub finalizer: Option>>, } -/// Catch Clause in a [`try/catch` statement](TryStatement). +/// Catch Clause in a [`TryStatement`]. /// /// This node creates a new scope inside its `body`. /// @@ -1478,7 +1476,7 @@ pub struct CatchClause<'a> { pub scope_id: Cell>, } -/// A caught error parameter in a [catch clause](CatchClause). +/// A caught error parameter in a [`CatchClause`]. /// /// # Examples /// @@ -1503,7 +1501,7 @@ pub struct CatchParameter<'a> { pub pattern: BindingPattern<'a>, } -/// Debugger Statement +/// `DebuggerStatement` /// /// # Example /// ```ts @@ -1661,7 +1659,7 @@ pub struct ArrayPattern<'a> { pub rest: Option>>, } -/// A `...rest` binding in an [array](ArrayPattern) or [object](ObjectPattern) destructure. +/// A `...rest` binding in an [`ArrayPattern`] or [`ObjectPattern`] destructure. /// /// ## Examples /// ```ts @@ -1683,7 +1681,7 @@ pub struct BindingRestElement<'a> { pub argument: BindingPattern<'a>, } -/// Function Statement or Expression +/// Function statement or expression /// /// Includes generator functions and function-valued class properties. /// Arrow functions are represented by [`ArrowFunctionExpression`]. @@ -2565,7 +2563,7 @@ pub enum ImportAttributeKey<'a> { StringLiteral(StringLiteral<'a>) = 1, } -/// Named Export Declaration +/// Named export declaration /// /// ## Example /// @@ -2592,7 +2590,7 @@ pub struct ExportNamedDeclaration<'a> { pub with_clause: Option>>, } -/// Export Default Declaration +/// Export default declaration /// /// ## Example /// @@ -2612,7 +2610,7 @@ pub struct ExportDefaultDeclaration<'a> { pub declaration: ExportDefaultDeclarationKind<'a>, } -/// Export All Declaration +/// Export all declaration /// /// ## Example /// @@ -2663,7 +2661,7 @@ pub struct ExportSpecifier<'a> { } inherit_variants! { -/// Export Default Declaration Kind +/// Export default declaration kind /// /// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance. /// diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index fac1d2248e787..6b7a23e68a823 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -791,7 +791,7 @@ pub use match_ts_type_name; /// TypeScript Qualified Name /// -/// A [type reference](TSTypeReference) qualified by a namespace. +/// A [`TSTypeReference`] qualified by a namespace. /// /// ## Example /// ```ts @@ -859,7 +859,7 @@ pub struct TSTypeParameterDeclaration<'a> { pub params: Vec<'a, TSTypeParameter<'a>>, } -/// TypeScript Type Alias Declaration Statement +/// TypeScript type alias declaration statement /// /// ## Example /// ```ts @@ -893,7 +893,7 @@ pub enum TSAccessibility { /// TypeScript Class Interface Heritage /// -/// `implements` clause of a [class declaration](Class). +/// `implements` clause of a [`Class`]. /// /// ## Example /// ```ts @@ -957,7 +957,7 @@ pub struct TSInterfaceBody<'a> { /// TypeScript Property Signature /// -/// Used in [classes](Class), [interfaces](TSInterfaceDeclaration), [mapped types](TSMappedType), +/// Used in [`Class`]es, [`TSInterfaceDeclaration`]s, [`TSMappedType`]s, /// etc. Part of a [`TSSignature`]. /// /// ## Example @@ -1152,7 +1152,7 @@ pub enum TSTypePredicateName<'a> { This(TSThisType) = 1, } -/// TypeScript Module and Namespace Declarations +/// TypeScript module and namespace declarations /// /// ## Examples /// ```ts @@ -1229,7 +1229,7 @@ pub enum TSModuleDeclarationKind { Namespace = 2, } -/// The name of a TypeScript [namespace or module declaration](TSModuleDeclaration). +/// The name of a TypeScript [`TSModuleDeclaration`]. /// /// Note that it is a syntax error for namespace declarations to have a string literal name. /// Modules may have either kind. @@ -1651,7 +1651,7 @@ pub struct TSExportAssignment<'a> { pub expression: Expression<'a>, } -/// Namespace Export Declaration in declaration files +/// Namespace export declaration in declaration files /// /// `export as namespace foo` #[ast(visit)]