Skip to content

Commit

Permalink
refactor(ast): reorder fields to reflect their visit order. (#3994)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Jul 1, 2024
1 parent bdee156 commit 0fe22a8
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 192 deletions.
6 changes: 3 additions & 3 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,10 @@ pub struct PrivateFieldExpression<'a> {
pub struct CallExpression<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub callee: Expression<'a>,
pub arguments: Vec<'a, Argument<'a>>,
pub optional: bool, // for optional chaining
pub callee: Expression<'a>,
pub type_parameters: Option<Box<'a, TSTypeParameterInstantiation<'a>>>,
pub optional: bool, // for optional chaining
}

/// New Expression
Expand Down Expand Up @@ -1659,6 +1659,7 @@ pub struct PropertyDefinition<'a> {
pub r#type: PropertyDefinitionType,
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub decorators: Vec<'a, Decorator<'a>>,
pub key: PropertyKey<'a>,
pub value: Option<Expression<'a>>,
pub computed: bool,
Expand All @@ -1670,7 +1671,6 @@ pub struct PropertyDefinition<'a> {
pub readonly: bool,
pub type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub accessibility: Option<TSAccessibility>,
pub decorators: Vec<'a, Decorator<'a>>,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_ast/src/ast/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,8 @@ pub struct TSTypeAliasDeclaration<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub id: BindingIdentifier<'a>,
pub type_annotation: TSType<'a>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub type_annotation: TSType<'a>,
pub declare: bool,
}

Expand Down Expand Up @@ -648,9 +648,9 @@ pub struct TSInterfaceDeclaration<'a> {
#[cfg_attr(feature = "serialize", serde(flatten))]
pub span: Span,
pub id: BindingIdentifier<'a>,
pub body: Box<'a, TSInterfaceBody<'a>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub extends: Option<Vec<'a, TSInterfaceHeritage<'a>>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub body: Box<'a, TSInterfaceBody<'a>>,
pub declare: bool,
}

Expand Down
12 changes: 6 additions & 6 deletions crates/oxc_ast/src/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ impl<'a> AstBuilder<'a> {
) -> Expression<'a> {
Expression::CallExpression(self.alloc(CallExpression {
span,
callee,
arguments,
optional,
callee,
type_parameters,
optional,
}))
}

Expand Down Expand Up @@ -1067,6 +1067,7 @@ impl<'a> AstBuilder<'a> {
ClassElement::PropertyDefinition(self.alloc(PropertyDefinition {
r#type,
span,
decorators,
key,
value,
computed,
Expand All @@ -1078,7 +1079,6 @@ impl<'a> AstBuilder<'a> {
readonly,
type_annotation,
accessibility,
decorators,
}))
}

Expand Down Expand Up @@ -1860,9 +1860,9 @@ impl<'a> AstBuilder<'a> {
Declaration::TSInterfaceDeclaration(self.alloc(TSInterfaceDeclaration {
span,
id,
body,
type_parameters,
extends,
type_parameters,
body,
declare,
}))
}
Expand All @@ -1879,8 +1879,8 @@ impl<'a> AstBuilder<'a> {
Declaration::TSTypeAliasDeclaration(self.alloc(TSTypeAliasDeclaration {
span,
id,
type_annotation,
type_parameters,
type_annotation,
declare,
}))
}
Expand Down
Loading

0 comments on commit 0fe22a8

Please sign in to comment.