Skip to content

Commit

Permalink
refactor(ast)!: reorder fields of ArrowFunctionExpression (#4364)
Browse files Browse the repository at this point in the history
Found in #4328
Same as #4248
  • Loading branch information
Dunqing committed Jul 19, 2024
1 parent 27cbd55 commit f68b659
Show file tree
Hide file tree
Showing 7 changed files with 577 additions and 578 deletions.
5 changes: 2 additions & 3 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1558,12 +1558,11 @@ pub struct ArrowFunctionExpression<'a> {
/// Is the function body an arrow expression? i.e. `() => expr` instead of `() => {}`
pub expression: bool,
pub r#async: bool,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
/// See `expression` for whether this arrow expression returns an expression.
pub body: Box<'a, FunctionBody<'a>>,

pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub scope_id: Cell<Option<ScopeId>>,
}

Expand Down
60 changes: 30 additions & 30 deletions crates/oxc_ast/src/generated/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,25 +351,25 @@ impl<'a> AstBuilder<'a> {
span: Span,
expression: bool,
r#async: bool,
params: T1,
body: T2,
type_parameters: T3,
return_type: T4,
type_parameters: T1,
params: T2,
return_type: T3,
body: T4,
) -> Expression<'a>
where
T1: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T2: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T4: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T1: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T4: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
{
Expression::ArrowFunctionExpression(self.alloc(self.arrow_function_expression(
span,
expression,
r#async,
params,
body,
type_parameters,
params,
return_type,
body,
)))
}

Expand Down Expand Up @@ -3863,25 +3863,25 @@ impl<'a> AstBuilder<'a> {
span: Span,
expression: bool,
r#async: bool,
params: T1,
body: T2,
type_parameters: T3,
return_type: T4,
type_parameters: T1,
params: T2,
return_type: T3,
body: T4,
) -> ArrowFunctionExpression<'a>
where
T1: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T2: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T4: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T1: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T4: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
{
ArrowFunctionExpression {
span,
expression,
r#async,
params: params.into_in(self.allocator),
body: body.into_in(self.allocator),
type_parameters: type_parameters.into_in(self.allocator),
params: params.into_in(self.allocator),
return_type: return_type.into_in(self.allocator),
body: body.into_in(self.allocator),
scope_id: Default::default(),
}
}
Expand All @@ -3892,25 +3892,25 @@ impl<'a> AstBuilder<'a> {
span: Span,
expression: bool,
r#async: bool,
params: T1,
body: T2,
type_parameters: T3,
return_type: T4,
type_parameters: T1,
params: T2,
return_type: T3,
body: T4,
) -> Box<'a, ArrowFunctionExpression<'a>>
where
T1: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T2: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T4: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T1: IntoIn<'a, Option<Box<'a, TSTypeParameterDeclaration<'a>>>>,
T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>,
T3: IntoIn<'a, Option<Box<'a, TSTypeAnnotation<'a>>>>,
T4: IntoIn<'a, Box<'a, FunctionBody<'a>>>,
{
self.arrow_function_expression(
span,
expression,
r#async,
params,
body,
type_parameters,
params,
return_type,
body,
)
.into_in(self.allocator)
}
Expand Down
Loading

0 comments on commit f68b659

Please sign in to comment.