From b31944538b6cff259d42b3cbbdb2aa5a753f8026 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:54:23 +0000 Subject: [PATCH 1/6] Initial plan From 4529562dcee42ffc26bb2a8e5c40585962841e25 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 Aug 2025 16:25:33 +0000 Subject: [PATCH 2/6] Fix inconsistent formatting in js.rs AST documentation Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com> --- crates/oxc_ast/src/ast/js.rs | 74 ++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index c663d8f9434ba..f1354d087d9d3 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`, which is a reference to a variable, function, class, or object. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -251,7 +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, +/// Represents a `binding identifier`, which is an identifier that is used to declare a variable, /// function, class, or object. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) @@ -281,7 +281,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`, which is an identifier that is used to label a statement. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -310,7 +310,7 @@ pub struct ThisExpression { /// `[1, 2, ...[3, 4], null]` in `const array = [1, 2, ...[3, 4], null];` /// -/// Represents an array literal, which can include elements, spread elements, or null values. +/// Represents an `array literal`, which can include elements, spread elements, or null values. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -320,7 +320,7 @@ pub struct ArrayExpression<'a> { } inherit_variants! { -/// Represents an element in an array literal. +/// Represents an element in an `array literal`. /// /// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -354,7 +354,7 @@ pub struct Elision { /// `{ a: 1 }` in `const obj = { a: 1 };` /// -/// Represents an object literal, which can include properties, spread properties, +/// Represents an `object literal`, which can include properties, spread properties, /// or computed properties. #[ast(visit)] #[derive(Debug)] @@ -365,7 +365,7 @@ pub struct ObjectExpression<'a> { pub properties: Vec<'a, ObjectPropertyKind<'a>>, } -/// Represents a property in an object literal. +/// Represents a property in an `object literal`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] @@ -378,7 +378,7 @@ pub enum ObjectPropertyKind<'a> { /// `a: 1` in `const obj = { a: 1 };` /// -/// Represents a property in an object literal. +/// Represents a property in an `object literal`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -427,7 +427,7 @@ pub enum PropertyKind { /// `` `Hello, ${name}` `` in `` const foo = `Hello, ${name}` `` /// -/// Represents a template literal, which can include quasi elements and expression elements. +/// Represents a `template literal`, which can include quasi elements and expression elements. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -456,7 +456,7 @@ pub struct TaggedTemplateExpression<'a> { /// `Hello, ` in `` `Hello, ${name}` `` /// -/// Represents a quasi element in a template literal. +/// Represents a quasi element in a `template literal`. #[ast(visit)] #[derive(Debug, Clone)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -492,7 +492,7 @@ pub struct TemplateElementValue<'a> { pub cooked: Option>, } -/// Represents a member access expression, which can include computed member access, +/// Represents a `member access expression`, which can include computed member access, /// static member access, or private field access. /// /// @@ -521,7 +521,7 @@ pub use match_member_expression; /// `ar[0]` in `const ar = [1, 2]; ar[0];` /// -/// Represents a computed member access expression, which can include an object and an expression. +/// Represents a `computed member access expression`, which can include an object and an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -536,7 +536,7 @@ pub struct ComputedMemberExpression<'a> { /// `console.log` in `console.log('Hello, World!');` /// -/// Represents a static member access expression, which can include an object and a property. +/// Represents a `static member access expression`, which can include an object and a property. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -550,7 +550,7 @@ pub struct StaticMemberExpression<'a> { /// `c.#a` in `class C { #a = 1; }; const c = new C(); c.#a;` /// -/// Represents a private field access expression, which can include an object and a private identifier. +/// Represents a `private field access expression`, which can include an object and a private identifier. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -565,7 +565,7 @@ pub struct PrivateFieldExpression<'a> { /// `foo()` in `function foo() { return 1; }; foo();` /// -/// Represents a call expression, which can include a callee and arguments. +/// Represents a `call expression`, which can include a callee and arguments. /// /// ## Examples /// ```ts @@ -597,7 +597,7 @@ pub struct CallExpression<'a> { /// `new C()` in `class C {}; new C();` /// -/// Represents a new expression, which can include a callee and arguments. +/// Represents a `new expression`, which can include a callee and arguments. /// /// ## Example /// ```ts @@ -624,7 +624,7 @@ pub struct NewExpression<'a> { /// `import.meta` in `console.log(import.meta);` /// -/// Represents a meta property. The following syntaxes are supported. `import.meta`, `new.target`. +/// Represents a `meta property`. The following syntaxes are supported. `import.meta`, `new.target`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -636,7 +636,7 @@ pub struct MetaProperty<'a> { /// `...[1, 2]` in `const arr = [...[1, 2]];` /// -/// Represents a spread element, which can include an argument. +/// Represents a `spread element`, which can include an argument. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -665,7 +665,7 @@ pub enum Argument<'a> { /// `++i` in `let i = 0; ++i;` /// -/// Represents an update expression, which can include an operator and an argument. +/// Represents an `update expression`, which can include an operator and an argument. /// The following syntaxes are supported: `++a`, `a++`, `--a`, `a--`. #[ast(visit)] #[derive(Debug)] @@ -679,7 +679,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`, which includes an operator and an argument. /// The following syntaxes are supported: `+a`, `-a`, `~a`, `!a`, `delete a`, `void a`, `typeof a`. #[ast(visit)] #[derive(Debug)] @@ -693,7 +693,7 @@ pub struct UnaryExpression<'a> { /// `1 + 1` in `const two = 1 + 1;` /// -/// Represents a binary expression, which include a left expression, an operator, and a right expression. +/// Represents a `binary expression`, which include a left expression, an operator, and a right expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -717,7 +717,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`, which includes a left expression, an operator, and a right expression. /// The following syntaxes are supported: `||`, `&&` and `??`. #[ast(visit)] #[derive(Debug)] @@ -731,7 +731,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`, which includes a test, a consequent, and an alternate. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -744,7 +744,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`, which includes an operator, a target, and an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -848,7 +848,7 @@ pub use match_assignment_target_pattern; /// `[a, b]` in `[a, b] = arr;` /// -/// Represents an array assignment target, which can include elements and a rest element. +/// Represents an `array assignment target`, which can include elements and a rest element. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -866,7 +866,7 @@ pub struct ArrayAssignmentTarget<'a> { /// `{ foo }` in `({ foo } = obj);` /// -/// Represents an object assignment target, which can include properties and a rest element. +/// Represents an `object assignment target`, which can include properties and a rest element. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -941,7 +941,7 @@ pub enum AssignmentTargetProperty<'a> { /// `foo` in `({ foo } = obj);` /// -/// Represents an assignment target property identifier, which includes a binding, +/// Represents an `assignment target property identifier`, which includes a binding, /// and an optional init expression. #[ast(visit)] #[derive(Debug)] @@ -961,7 +961,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`, which includes a name and a binding. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -992,7 +992,7 @@ pub struct AssignmentTargetPropertyProperty<'a> { /// `a++, b++` in `let a = 1, b = 2; let result = (a++, b++);` /// -/// Represents a sequence expression. +/// Represents a `sequence expression`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1003,7 +1003,7 @@ pub struct SequenceExpression<'a> { /// `super` in `class C extends B { constructor() { super(); } }` /// -/// Represents a super expression. +/// Represents a `super expression`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1013,7 +1013,7 @@ pub struct Super { /// `await` in `await foo();` /// -/// Represents an await expression, which can include an argument. +/// Represents an `await expression`, which can include an argument. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1024,7 +1024,7 @@ pub struct AwaitExpression<'a> { /// `foo?.bar` in `foo?.bar;` /// -/// Represents a chain expression, which can include an expression. +/// Represents a `chain expression`, which can include an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1053,7 +1053,7 @@ pub enum ChainElement<'a> { /// `(a + b)` in `const res = (a + b) / c;` /// -/// Represents a parenthesized expression, which can include an expression. +/// Represents a `parenthesized expression`, which can include an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1101,7 +1101,7 @@ pub enum Statement<'a> { /// `"use strict";` in `"use strict";` /// -/// Represents a directive statement, which can include a string literal. +/// Represents a `directive statement`, which can include a string literal. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1116,7 +1116,7 @@ pub struct Directive<'a> { /// `#! /usr/bin/env node` in `#! /usr/bin/env node` /// -/// Represents a hashbang directive, which can include a value. +/// Represents a `hashbang directive`, which can include a value. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1127,7 +1127,7 @@ pub struct Hashbang<'a> { /// `{ let foo = 1; }` in `if(true) { let foo = 1; }` /// -/// Represents a block statement, which can include a body. +/// Represents a `block statement`, which can include a body. #[ast(visit)] #[scope] #[derive(Debug)] @@ -1173,7 +1173,7 @@ pub use match_declaration; /// `let a;` in `let a; a = 1;` /// -/// Represents a variable declaration, which can include a kind, declarations, and modifiers. +/// Represents a `variable declaration`, which can include a kind, declarations, and modifiers. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] From a5371191b3aed56f29cfe441c0f0127c20b5c156 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 Aug 2025 16:32:26 +0000 Subject: [PATCH 3/6] Complete AST documentation formatting improvements Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com> --- crates/oxc_ast/src/ast/js.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index f1354d087d9d3..3f810470c0022 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -1936,7 +1936,7 @@ pub struct ArrowFunctionExpression<'a> { pub params: Box<'a, FormalParameters<'a>>, #[ts] pub return_type: Option>>, - /// See `expression` for whether this arrow expression returns an expression. + /// See `expression` field for whether this arrow expression returns an expression. // ESTree: https://github.com/estree/estree/blob/master/es2015.md#arrowfunctionexpression #[estree(via = ArrowFunctionExpressionBody)] pub body: Box<'a, FunctionBody<'a>>, From 04af1dedc282edcfb29be038a4c269f5d180b2d1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:16:10 +0000 Subject: [PATCH 4/6] Fix JavaScript/TypeScript code snippets to use proper backticks in AST documentation Co-authored-by: overlookmotel <557937+overlookmotel@users.noreply.github.com> --- crates/oxc_ast/src/ast/js.rs | 90 ++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 3f810470c0022..8e4d4c1dc702d 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, which is a reference to a variable, function, class, or object. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -251,7 +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, +/// Represents a binding identifier, which is an identifier that is used to declare a variable, /// function, class, or object. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) @@ -281,7 +281,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, which is an identifier that is used to label a statement. /// /// See: [13.1 Identifiers](https://tc39.es/ecma262/#sec-identifiers) #[ast(visit)] @@ -310,7 +310,7 @@ pub struct ThisExpression { /// `[1, 2, ...[3, 4], null]` in `const array = [1, 2, ...[3, 4], null];` /// -/// Represents an `array literal`, which can include elements, spread elements, or null values. +/// Represents an array literal, which can include elements, spread elements, or null values. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -320,7 +320,7 @@ pub struct ArrayExpression<'a> { } inherit_variants! { -/// Represents an element in an `array literal`. +/// Represents an element in an array literal. /// /// Inherits variants from [`Expression`]. See [`ast` module docs] for explanation of inheritance. /// @@ -354,7 +354,7 @@ pub struct Elision { /// `{ a: 1 }` in `const obj = { a: 1 };` /// -/// Represents an `object literal`, which can include properties, spread properties, +/// Represents an object literal, which can include properties, spread properties, /// or computed properties. #[ast(visit)] #[derive(Debug)] @@ -365,7 +365,7 @@ pub struct ObjectExpression<'a> { pub properties: Vec<'a, ObjectPropertyKind<'a>>, } -/// Represents a property in an `object literal`. +/// Represents a property in an object literal. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] @@ -378,7 +378,7 @@ pub enum ObjectPropertyKind<'a> { /// `a: 1` in `const obj = { a: 1 };` /// -/// Represents a property in an `object literal`. +/// Represents a property in an object literal. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -427,7 +427,7 @@ pub enum PropertyKind { /// `` `Hello, ${name}` `` in `` const foo = `Hello, ${name}` `` /// -/// Represents a `template literal`, which can include quasi elements and expression elements. +/// Represents a template literal, which can include quasi elements and expression elements. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -456,7 +456,7 @@ pub struct TaggedTemplateExpression<'a> { /// `Hello, ` in `` `Hello, ${name}` `` /// -/// Represents a quasi element in a `template literal`. +/// Represents a quasi element in a template literal. #[ast(visit)] #[derive(Debug, Clone)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -492,7 +492,7 @@ pub struct TemplateElementValue<'a> { pub cooked: Option>, } -/// Represents a `member access expression`, which can include computed member access, +/// Represents a member access expression, which can include computed member access, /// static member access, or private field access. /// /// @@ -521,7 +521,7 @@ pub use match_member_expression; /// `ar[0]` in `const ar = [1, 2]; ar[0];` /// -/// Represents a `computed member access expression`, which can include an object and an expression. +/// Represents a computed member access expression, which can include an object and an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -536,7 +536,7 @@ pub struct ComputedMemberExpression<'a> { /// `console.log` in `console.log('Hello, World!');` /// -/// Represents a `static member access expression`, which can include an object and a property. +/// Represents a static member access expression, which can include an object and a property. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -550,7 +550,7 @@ pub struct StaticMemberExpression<'a> { /// `c.#a` in `class C { #a = 1; }; const c = new C(); c.#a;` /// -/// Represents a `private field access expression`, which can include an object and a private identifier. +/// Represents a private field access expression, which can include an object and a private identifier. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -565,7 +565,7 @@ pub struct PrivateFieldExpression<'a> { /// `foo()` in `function foo() { return 1; }; foo();` /// -/// Represents a `call expression`, which can include a callee and arguments. +/// Represents a call expression, which can include a callee and arguments. /// /// ## Examples /// ```ts @@ -597,7 +597,7 @@ pub struct CallExpression<'a> { /// `new C()` in `class C {}; new C();` /// -/// Represents a `new expression`, which can include a callee and arguments. +/// Represents a new expression, which can include a callee and arguments. /// /// ## Example /// ```ts @@ -624,7 +624,7 @@ pub struct NewExpression<'a> { /// `import.meta` in `console.log(import.meta);` /// -/// Represents a `meta property`. The following syntaxes are supported. `import.meta`, `new.target`. +/// Represents a meta property. The following syntaxes are supported. `import.meta`, `new.target`. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -636,7 +636,7 @@ pub struct MetaProperty<'a> { /// `...[1, 2]` in `const arr = [...[1, 2]];` /// -/// Represents a `spread element`, which can include an argument. +/// Represents a spread element, which can include an argument. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -665,7 +665,7 @@ pub enum Argument<'a> { /// `++i` in `let i = 0; ++i;` /// -/// Represents an `update expression`, which can include an operator and an argument. +/// Represents an update expression, which can include an operator and an argument. /// The following syntaxes are supported: `++a`, `a++`, `--a`, `a--`. #[ast(visit)] #[derive(Debug)] @@ -679,7 +679,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, which includes an operator and an argument. /// The following syntaxes are supported: `+a`, `-a`, `~a`, `!a`, `delete a`, `void a`, `typeof a`. #[ast(visit)] #[derive(Debug)] @@ -693,7 +693,7 @@ pub struct UnaryExpression<'a> { /// `1 + 1` in `const two = 1 + 1;` /// -/// Represents a `binary expression`, which include a left expression, an operator, and a right expression. +/// Represents a binary expression, which include a left expression, an operator, and a right expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -717,7 +717,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, which includes a left expression, an operator, and a right expression. /// The following syntaxes are supported: `||`, `&&` and `??`. #[ast(visit)] #[derive(Debug)] @@ -731,7 +731,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, which includes a test, a consequent, and an alternate. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -744,7 +744,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, which includes an operator, a target, and an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -848,7 +848,7 @@ pub use match_assignment_target_pattern; /// `[a, b]` in `[a, b] = arr;` /// -/// Represents an `array assignment target`, which can include elements and a rest element. +/// Represents an array assignment target, which can include elements and a rest element. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -866,7 +866,7 @@ pub struct ArrayAssignmentTarget<'a> { /// `{ foo }` in `({ foo } = obj);` /// -/// Represents an `object assignment target`, which can include properties and a rest element. +/// Represents an object assignment target, which can include properties and a rest element. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -941,7 +941,7 @@ pub enum AssignmentTargetProperty<'a> { /// `foo` in `({ foo } = obj);` /// -/// Represents an `assignment target property identifier`, which includes a binding, +/// Represents an assignment target property identifier, which includes a binding, /// and an optional init expression. #[ast(visit)] #[derive(Debug)] @@ -961,7 +961,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, which includes a name and a binding. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -992,7 +992,7 @@ pub struct AssignmentTargetPropertyProperty<'a> { /// `a++, b++` in `let a = 1, b = 2; let result = (a++, b++);` /// -/// Represents a `sequence expression`. +/// Represents a sequence expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1003,7 +1003,7 @@ pub struct SequenceExpression<'a> { /// `super` in `class C extends B { constructor() { super(); } }` /// -/// Represents a `super expression`. +/// Represents a super expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1013,7 +1013,7 @@ pub struct Super { /// `await` in `await foo();` /// -/// Represents an `await expression`, which can include an argument. +/// Represents an await expression, which can include an argument. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1024,7 +1024,7 @@ pub struct AwaitExpression<'a> { /// `foo?.bar` in `foo?.bar;` /// -/// Represents a `chain expression`, which can include an expression. +/// Represents a chain expression, which can include an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1053,7 +1053,7 @@ pub enum ChainElement<'a> { /// `(a + b)` in `const res = (a + b) / c;` /// -/// Represents a `parenthesized expression`, which can include an expression. +/// Represents a parenthesized expression, which can include an expression. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1101,7 +1101,7 @@ pub enum Statement<'a> { /// `"use strict";` in `"use strict";` /// -/// Represents a `directive statement`, which can include a string literal. +/// Represents a directive statement, which can include a string literal. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1116,7 +1116,7 @@ pub struct Directive<'a> { /// `#! /usr/bin/env node` in `#! /usr/bin/env node` /// -/// Represents a `hashbang directive`, which can include a value. +/// Represents a hashbang directive, which can include a value. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1127,7 +1127,7 @@ pub struct Hashbang<'a> { /// `{ let foo = 1; }` in `if(true) { let foo = 1; }` /// -/// Represents a `block statement`, which can include a body. +/// Represents a block statement, which can include a body. #[ast(visit)] #[scope] #[derive(Debug)] @@ -1173,7 +1173,7 @@ pub use match_declaration; /// `let a;` in `let a; a = 1;` /// -/// Represents a `variable declaration`, which can include a kind, declarations, and modifiers. +/// Represents a variable declaration, which can include a kind, declarations, and modifiers. #[ast(visit)] #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, ContentEq, ESTree)] @@ -1936,7 +1936,7 @@ pub struct ArrowFunctionExpression<'a> { pub params: Box<'a, FormalParameters<'a>>, #[ts] pub return_type: Option>>, - /// See `expression` field for whether this arrow expression returns an expression. + /// See `expression` for whether this arrow expression returns an expression. // ESTree: https://github.com/estree/estree/blob/master/es2015.md#arrowfunctionexpression #[estree(via = ArrowFunctionExpressionBody)] pub body: Box<'a, FunctionBody<'a>>, @@ -2457,12 +2457,12 @@ pub enum ImportPhase { #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] pub enum ImportDeclarationSpecifier<'a> { - /// import {imported} from "source" - /// import {imported as local} from "source" + /// `import {imported} from "source"` + /// `import {imported as local} from "source"` ImportSpecifier(Box<'a, ImportSpecifier<'a>>) = 0, - /// import local from "source" + /// `import local from "source"` ImportDefaultSpecifier(Box<'a, ImportDefaultSpecifier<'a>>) = 1, - /// import * as local from "source" + /// `import * as local from "source"` ImportNamespaceSpecifier(Box<'a, ImportNamespaceSpecifier<'a>>) = 2, } @@ -2556,8 +2556,8 @@ pub enum ImportAttributeKey<'a> { /// /// ```ts /// // ________ specifiers -/// export { Foo, Bar }; -/// export type { Baz } from 'baz'; +/// `export { Foo, Bar };` +/// `export type { Baz } from 'baz';` /// // ^^^^ ^^^^^ /// // export_kind source /// ``` @@ -2603,7 +2603,7 @@ pub struct ExportDefaultDeclaration<'a> { /// /// ```ts /// // _______ exported -/// export * as numbers from '../numbers.js'; +/// `export * as numbers from '../numbers.js';` /// // ^^^^^^^^^^^^^^^ source /// ``` #[ast(visit)] From db6e1fbd1b6a3b9d513c4f664ab8d2772beb95e8 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Fri, 1 Aug 2025 21:05:25 +0100 Subject: [PATCH 5/6] Revert erroneous changes --- crates/oxc_ast/src/ast/js.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index 8e4d4c1dc702d..b06d39216f544 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -2556,8 +2556,8 @@ pub enum ImportAttributeKey<'a> { /// /// ```ts /// // ________ specifiers -/// `export { Foo, Bar };` -/// `export type { Baz } from 'baz';` +/// export { Foo, Bar }; +/// export type { Baz } from 'baz'; /// // ^^^^ ^^^^^ /// // export_kind source /// ``` @@ -2603,7 +2603,7 @@ pub struct ExportDefaultDeclaration<'a> { /// /// ```ts /// // _______ exported -/// `export * as numbers from '../numbers.js';` +/// export * as numbers from '../numbers.js'; /// // ^^^^^^^^^^^^^^^ source /// ``` #[ast(visit)] From 7e01f88b267761688bcb89e34fb21a250c832ae8 Mon Sep 17 00:00:00 2001 From: overlookmotel Date: Fri, 1 Aug 2025 21:05:53 +0100 Subject: [PATCH 6/6] Add semi-colons --- crates/oxc_ast/src/ast/js.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index b06d39216f544..75b8185919b01 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -2457,12 +2457,12 @@ pub enum ImportPhase { #[derive(Debug)] #[generate_derive(CloneIn, Dummy, TakeIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ESTree)] pub enum ImportDeclarationSpecifier<'a> { - /// `import {imported} from "source"` - /// `import {imported as local} from "source"` + /// `import {imported} from "source";` + /// `import {imported as local} from "source";` ImportSpecifier(Box<'a, ImportSpecifier<'a>>) = 0, - /// `import local from "source"` + /// `import local from "source";` ImportDefaultSpecifier(Box<'a, ImportDefaultSpecifier<'a>>) = 1, - /// `import * as local from "source"` + /// `import * as local from "source";` ImportNamespaceSpecifier(Box<'a, ImportNamespaceSpecifier<'a>>) = 2, }