Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/.generated_ast_watch_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ src:
- 'crates/oxc_ast/src/generated/derive_clone_in.rs'
- 'crates/oxc_regular_expression/src/generated/derive_clone_in.rs'
- 'crates/oxc_syntax/src/generated/derive_clone_in.rs'
- 'crates/oxc_ast/src/generated/derive_get_address.rs'
- 'crates/oxc_regular_expression/src/generated/derive_get_address.rs'
- 'crates/oxc_ast/src/generated/derive_get_span.rs'
- 'crates/oxc_ast/src/generated/derive_get_span_mut.rs'
- 'crates/oxc_ast/src/generated/derive_content_eq.rs'
Expand Down
42 changes: 21 additions & 21 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use std::cell::Cell;

use oxc_allocator::{Box, CloneIn, Vec};
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
use oxc_ast_macros::ast;
use oxc_estree::ESTree;
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, SourceType, Span};
Expand Down Expand Up @@ -53,7 +53,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum Expression<'a> {
/// See [`BooleanLiteral`] for AST node details.
BooleanLiteral(Box<'a, BooleanLiteral>) = 0,
Expand Down Expand Up @@ -346,7 +346,7 @@ pub struct ObjectExpression<'a> {
/// Represents a property in an object literal.
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ObjectPropertyKind<'a> {
/// `a: 1` in `const obj = { a: 1 };`
ObjectProperty(Box<'a, ObjectProperty<'a>>) = 0,
Expand Down Expand Up @@ -378,7 +378,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum PropertyKey<'a> {
/// `a` in `const obj = { a: 1 }; obj.a;`
StaticIdentifier(Box<'a, IdentifierName<'a>>) = 64,
Expand Down Expand Up @@ -462,7 +462,7 @@ pub struct TemplateElementValue<'a> {
/// <https://tc39.es/ecma262/#prod-MemberExpression>
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum MemberExpression<'a> {
/// `ar[0]` in `const ar = [1, 2]; ar[0];`
ComputedMemberExpression(Box<'a, ComputedMemberExpression<'a>>) = 48,
Expand Down Expand Up @@ -605,7 +605,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum Argument<'a> {
/// `...[1, 2]` in `const arr = [...[1, 2]];`
SpreadElement(Box<'a, SpreadElement<'a>>) = 64,
Expand Down Expand Up @@ -713,7 +713,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum AssignmentTarget<'a> {
// `SimpleAssignmentTarget` variants added here by `inherit_variants!` macro
@inherit SimpleAssignmentTarget
Expand All @@ -730,7 +730,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum SimpleAssignmentTarget<'a> {
AssignmentTargetIdentifier(Box<'a, IdentifierReference<'a>>) = 0,
TSAsExpression(Box<'a, TSAsExpression<'a>>) = 1,
Expand Down Expand Up @@ -783,7 +783,7 @@ pub use match_simple_assignment_target;

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum AssignmentTargetPattern<'a> {
ArrayAssignmentTarget(Box<'a, ArrayAssignmentTarget<'a>>) = 8,
ObjectAssignmentTarget(Box<'a, ObjectAssignmentTarget<'a>>) = 9,
Expand Down Expand Up @@ -847,7 +847,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum AssignmentTargetMaybeDefault<'a> {
AssignmentTargetWithDefault(Box<'a, AssignmentTargetWithDefault<'a>>) = 16,
// `AssignmentTarget` variants added here by `inherit_variants!` macro
Expand All @@ -866,7 +866,7 @@ pub struct AssignmentTargetWithDefault<'a> {

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum AssignmentTargetProperty<'a> {
AssignmentTargetPropertyIdentifier(Box<'a, AssignmentTargetPropertyIdentifier<'a>>) = 0,
AssignmentTargetPropertyProperty(Box<'a, AssignmentTargetPropertyProperty<'a>>) = 1,
Expand Down Expand Up @@ -947,7 +947,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ChainElement<'a> {
CallExpression(Box<'a, CallExpression<'a>>) = 0,
/// `foo?.baz!` or `foo?.[bar]!`
Expand Down Expand Up @@ -977,7 +977,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum Statement<'a> {
// Statements
BlockStatement(Box<'a, BlockStatement<'a>>) = 0,
Expand Down Expand Up @@ -1048,7 +1048,7 @@ pub struct BlockStatement<'a> {
/// Declarations and the Variable Statement
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum Declaration<'a> {
VariableDeclaration(Box<'a, VariableDeclaration<'a>>) = 32,
#[visit(args(flags = ScopeFlags::Function))]
Expand Down Expand Up @@ -1197,7 +1197,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ForStatementInit<'a> {
VariableDeclaration(Box<'a, VariableDeclaration<'a>>) = 64,
// `Expression` variants added here by `inherit_variants!` macro
Expand Down Expand Up @@ -1228,7 +1228,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ForStatementLeft<'a> {
VariableDeclaration(Box<'a, VariableDeclaration<'a>>) = 16,
// `AssignmentTarget` variants added here by `inherit_variants!` macro
Expand Down Expand Up @@ -1451,7 +1451,7 @@ pub struct BindingPattern<'a> {

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum BindingPatternKind<'a> {
/// `const a = 1`
BindingIdentifier(Box<'a, BindingIdentifier<'a>>) = 0,
Expand Down Expand Up @@ -1855,7 +1855,7 @@ pub struct ClassBody<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ClassElement<'a> {
StaticBlock(Box<'a, StaticBlock<'a>>) = 0,
/// Class Methods
Expand Down Expand Up @@ -2086,7 +2086,7 @@ pub struct StaticBlock<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ModuleDeclaration<'a> {
/// `import hello from './world.js';`
/// `import * as t from './world.js';`
Expand Down Expand Up @@ -2208,7 +2208,7 @@ pub struct ImportDeclaration<'a> {

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ImportDeclarationSpecifier<'a> {
/// import {imported} from "source"
/// import {imported as local} from "source"
Expand Down Expand Up @@ -2398,7 +2398,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum ExportDefaultDeclarationKind<'a> {
#[visit(args(flags = ScopeFlags::Function))]
FunctionDeclaration(Box<'a, Function<'a>>) = 64,
Expand Down
14 changes: 7 additions & 7 deletions crates/oxc_ast/src/ast/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// They are purely markers for codegen used in `tasks/ast_tools` and `crates/oxc_traverse/scripts`. See docs in those crates.
// Read [`macro@oxc_ast_macros::ast`] for more information.

use oxc_allocator::{Box, CloneIn, Vec};
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
use oxc_ast_macros::ast;
use oxc_estree::ESTree;
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
Expand Down Expand Up @@ -146,7 +146,7 @@ pub struct JSXClosingFragment {
/// JSX Element Name
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash)]
pub enum JSXElementName<'a> {
/// `<div />`
Identifier(Box<'a, JSXIdentifier<'a>>) = 0,
Expand Down Expand Up @@ -224,7 +224,7 @@ pub struct JSXMemberExpression<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash)]
pub enum JSXMemberExpressionObject<'a> {
/// `<Apple.Orange />`
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,
Expand Down Expand Up @@ -303,7 +303,7 @@ pub struct JSXEmptyExpression {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum JSXAttributeItem<'a> {
/// A `key="value"` attribute
Attribute(Box<'a, JSXAttribute<'a>>) = 0,
Expand Down Expand Up @@ -370,7 +370,7 @@ pub struct JSXSpreadAttribute<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum JSXAttributeName<'a> {
/// An attribute name without a namespace prefix, e.g. `foo` in `foo="bar"`.
Identifier(Box<'a, JSXIdentifier<'a>>) = 0,
Expand Down Expand Up @@ -398,7 +398,7 @@ pub enum JSXAttributeName<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum JSXAttributeValue<'a> {
/// `<Component foo="bar" />`
StringLiteral(Box<'a, StringLiteral<'a>>) = 0,
Expand Down Expand Up @@ -432,7 +432,7 @@ pub struct JSXIdentifier<'a> {
/// Part of a [`JSXElement`].
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum JSXChild<'a> {
/// `<Foo>Some Text</Foo>`
Text(Box<'a, JSXText<'a>>) = 0,
Expand Down
20 changes: 10 additions & 10 deletions crates/oxc_ast/src/ast/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::cell::Cell;

use oxc_allocator::{Box, CloneIn, Vec};
use oxc_allocator::{Box, CloneIn, GetAddress, Vec};
use oxc_ast_macros::ast;
use oxc_estree::ESTree;
use oxc_span::{cmp::ContentEq, hash::ContentHash, Atom, GetSpan, GetSpanMut, Span};
Expand Down Expand Up @@ -105,7 +105,7 @@ pub struct TSEnumMember<'a> {
/// TS Enum Member Name
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSEnumMemberName<'a> {
Identifier(Box<'a, IdentifierName<'a>>) = 0,
String(Box<'a, StringLiteral<'a>>) = 1,
Expand Down Expand Up @@ -158,7 +158,7 @@ pub struct TSLiteralType<'a> {
/// A literal in a [`TSLiteralType`].
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSLiteral<'a> {
BooleanLiteral(Box<'a, BooleanLiteral>) = 0,
NullLiteral(Box<'a, NullLiteral>) = 1,
Expand All @@ -183,7 +183,7 @@ pub enum TSLiteral<'a> {
/// ```
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSType<'a> {
// Keyword
TSAnyKeyword(Box<'a, TSAnyKeyword>) = 0,
Expand Down Expand Up @@ -512,7 +512,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSTupleElement<'a> {
// Discriminants start at 64, so that `TSTupleElement::is_ts_type` is a single
// bitwise AND operation on the discriminant (`discriminant & 63 != 0`).
Expand Down Expand Up @@ -732,7 +732,7 @@ pub struct TSTypeReference<'a> {
/// NamespaceName . IdentifierReference
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSTypeName<'a> {
IdentifierReference(Box<'a, IdentifierReference<'a>>) = 0,
QualifiedName(Box<'a, TSQualifiedName<'a>>) = 1,
Expand Down Expand Up @@ -943,7 +943,7 @@ pub struct TSPropertySignature<'a> {

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSSignature<'a> {
TSIndexSignature(Box<'a, TSIndexSignature<'a>>) = 0,
TSPropertySignature(Box<'a, TSPropertySignature<'a>>) = 1,
Expand Down Expand Up @@ -1206,7 +1206,7 @@ pub enum TSModuleDeclarationName<'a> {

#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSModuleDeclarationBody<'a> {
TSModuleDeclaration(Box<'a, TSModuleDeclaration<'a>>) = 0,
TSModuleBlock(Box<'a, TSModuleBlock<'a>>) = 1,
Expand Down Expand Up @@ -1280,7 +1280,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSTypeQueryExprName<'a> {
TSImportType(Box<'a, TSImportType<'a>>) = 2,
// `TSTypeName` variants added here by `inherit_variants!` macro
Expand Down Expand Up @@ -1532,7 +1532,7 @@ inherit_variants! {
/// [`ast` module docs]: `super`
#[ast(visit)]
#[derive(Debug)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ContentHash, ESTree)]
#[generate_derive(CloneIn, GetSpan, GetSpanMut, GetAddress, ContentEq, ContentHash, ESTree)]
pub enum TSModuleReference<'a> {
ExternalModuleReference(Box<'a, TSExternalModuleReference<'a>>) = 2,
// `TSTypeName` variants added here by `inherit_variants!` macro
Expand Down
Loading