Skip to content

Commit

Permalink
refactor(ast): box TSThisParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Aug 29, 2024
1 parent b103737 commit 0f35d10
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 157 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ pub struct Function<'a> {
/// return this.admin;
/// });
/// ```
pub this_param: Option<TSThisParameter<'a>>,
pub this_param: Option<Box<'a, TSThisParameter<'a>>>,
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub body: Option<Box<'a, FunctionBody<'a>>>,
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_ast/src/ast/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ pub struct TSMethodSignature<'a> {
pub computed: bool,
pub optional: bool,
pub kind: TSMethodSignatureKind,
pub this_param: Option<TSThisParameter<'a>>,
pub this_param: Option<Box<'a, TSThisParameter<'a>>>,
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Option<Box<'a, TSTypeAnnotation<'a>>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
Expand Down Expand Up @@ -1178,7 +1178,7 @@ pub enum TSImportAttributeName<'a> {
pub struct TSFunctionType<'a> {
#[serde(flatten)]
pub span: Span,
pub this_param: Option<TSThisParameter<'a>>,
pub this_param: Option<Box<'a, TSThisParameter<'a>>>,
pub params: Box<'a, FormalParameters<'a>>,
pub return_type: Box<'a, TSTypeAnnotation<'a>>,
pub type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast_builder_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'a> AstBuilder<'a> {
false,
false,
Option::<TSTypeParameterDeclaration>::None,
None,
None::<Box<'a, TSThisParameter<'a>>>,
params,
Option::<TSTypeAnnotation>::None,
body,
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/ast_impl/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ impl<'a> Function<'a> {
generator: bool,
r#async: bool,
declare: bool,
this_param: Option<TSThisParameter<'a>>,
this_param: Option<Box<'a, TSThisParameter<'a>>>,
params: Box<'a, FormalParameters<'a>>,
body: Option<Box<'a, FunctionBody<'a>>>,
type_parameters: Option<Box<'a, TSTypeParameterDeclaration<'a>>>,
Expand Down
56 changes: 28 additions & 28 deletions crates/oxc_ast/src/generated/assert_layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ const _: () = {
assert!(offset_of!(BindingRestElement, span) == 0usize);
assert!(offset_of!(BindingRestElement, argument) == 8usize);

assert!(size_of::<Function>() == 136usize);
assert!(size_of::<Function>() == 104usize);
assert!(align_of::<Function>() == 8usize);
assert!(offset_of!(Function, r#type) == 0usize);
assert!(offset_of!(Function, span) == 4usize);
Expand All @@ -548,10 +548,10 @@ const _: () = {
assert!(offset_of!(Function, declare) == 50usize);
assert!(offset_of!(Function, type_parameters) == 56usize);
assert!(offset_of!(Function, this_param) == 64usize);
assert!(offset_of!(Function, params) == 104usize);
assert!(offset_of!(Function, return_type) == 112usize);
assert!(offset_of!(Function, body) == 120usize);
assert!(offset_of!(Function, scope_id) == 128usize);
assert!(offset_of!(Function, params) == 72usize);
assert!(offset_of!(Function, return_type) == 80usize);
assert!(offset_of!(Function, body) == 88usize);
assert!(offset_of!(Function, scope_id) == 96usize);

assert!(size_of::<FunctionType>() == 1usize);
assert!(align_of::<FunctionType>() == 1usize);
Expand Down Expand Up @@ -1042,18 +1042,18 @@ const _: () = {
assert!(size_of::<TSMethodSignatureKind>() == 1usize);
assert!(align_of::<TSMethodSignatureKind>() == 1usize);

assert!(size_of::<TSMethodSignature>() == 104usize);
assert!(size_of::<TSMethodSignature>() == 72usize);
assert!(align_of::<TSMethodSignature>() == 8usize);
assert!(offset_of!(TSMethodSignature, span) == 0usize);
assert!(offset_of!(TSMethodSignature, key) == 8usize);
assert!(offset_of!(TSMethodSignature, computed) == 24usize);
assert!(offset_of!(TSMethodSignature, optional) == 25usize);
assert!(offset_of!(TSMethodSignature, kind) == 26usize);
assert!(offset_of!(TSMethodSignature, this_param) == 32usize);
assert!(offset_of!(TSMethodSignature, params) == 72usize);
assert!(offset_of!(TSMethodSignature, return_type) == 80usize);
assert!(offset_of!(TSMethodSignature, type_parameters) == 88usize);
assert!(offset_of!(TSMethodSignature, scope_id) == 96usize);
assert!(offset_of!(TSMethodSignature, params) == 40usize);
assert!(offset_of!(TSMethodSignature, return_type) == 48usize);
assert!(offset_of!(TSMethodSignature, type_parameters) == 56usize);
assert!(offset_of!(TSMethodSignature, scope_id) == 64usize);

assert!(size_of::<TSConstructSignatureDeclaration>() == 40usize);
assert!(align_of::<TSConstructSignatureDeclaration>() == 8usize);
Expand Down Expand Up @@ -1152,13 +1152,13 @@ const _: () = {
assert!(size_of::<TSImportAttributeName>() == 32usize);
assert!(align_of::<TSImportAttributeName>() == 8usize);

assert!(size_of::<TSFunctionType>() == 72usize);
assert!(size_of::<TSFunctionType>() == 40usize);
assert!(align_of::<TSFunctionType>() == 8usize);
assert!(offset_of!(TSFunctionType, span) == 0usize);
assert!(offset_of!(TSFunctionType, this_param) == 8usize);
assert!(offset_of!(TSFunctionType, params) == 48usize);
assert!(offset_of!(TSFunctionType, return_type) == 56usize);
assert!(offset_of!(TSFunctionType, type_parameters) == 64usize);
assert!(offset_of!(TSFunctionType, params) == 16usize);
assert!(offset_of!(TSFunctionType, return_type) == 24usize);
assert!(offset_of!(TSFunctionType, type_parameters) == 32usize);

assert!(size_of::<TSConstructorType>() == 40usize);
assert!(align_of::<TSConstructorType>() == 8usize);
Expand Down Expand Up @@ -1939,7 +1939,7 @@ const _: () = {
assert!(offset_of!(BindingRestElement, span) == 0usize);
assert!(offset_of!(BindingRestElement, argument) == 8usize);

assert!(size_of::<Function>() == 84usize);
assert!(size_of::<Function>() == 60usize);
assert!(align_of::<Function>() == 4usize);
assert!(offset_of!(Function, r#type) == 0usize);
assert!(offset_of!(Function, span) == 4usize);
Expand All @@ -1949,10 +1949,10 @@ const _: () = {
assert!(offset_of!(Function, declare) == 34usize);
assert!(offset_of!(Function, type_parameters) == 36usize);
assert!(offset_of!(Function, this_param) == 40usize);
assert!(offset_of!(Function, params) == 68usize);
assert!(offset_of!(Function, return_type) == 72usize);
assert!(offset_of!(Function, body) == 76usize);
assert!(offset_of!(Function, scope_id) == 80usize);
assert!(offset_of!(Function, params) == 44usize);
assert!(offset_of!(Function, return_type) == 48usize);
assert!(offset_of!(Function, body) == 52usize);
assert!(offset_of!(Function, scope_id) == 56usize);

assert!(size_of::<FunctionType>() == 1usize);
assert!(align_of::<FunctionType>() == 1usize);
Expand Down Expand Up @@ -2443,18 +2443,18 @@ const _: () = {
assert!(size_of::<TSMethodSignatureKind>() == 1usize);
assert!(align_of::<TSMethodSignatureKind>() == 1usize);

assert!(size_of::<TSMethodSignature>() == 64usize);
assert!(size_of::<TSMethodSignature>() == 40usize);
assert!(align_of::<TSMethodSignature>() == 4usize);
assert!(offset_of!(TSMethodSignature, span) == 0usize);
assert!(offset_of!(TSMethodSignature, key) == 8usize);
assert!(offset_of!(TSMethodSignature, computed) == 16usize);
assert!(offset_of!(TSMethodSignature, optional) == 17usize);
assert!(offset_of!(TSMethodSignature, kind) == 18usize);
assert!(offset_of!(TSMethodSignature, this_param) == 20usize);
assert!(offset_of!(TSMethodSignature, params) == 48usize);
assert!(offset_of!(TSMethodSignature, return_type) == 52usize);
assert!(offset_of!(TSMethodSignature, type_parameters) == 56usize);
assert!(offset_of!(TSMethodSignature, scope_id) == 60usize);
assert!(offset_of!(TSMethodSignature, params) == 24usize);
assert!(offset_of!(TSMethodSignature, return_type) == 28usize);
assert!(offset_of!(TSMethodSignature, type_parameters) == 32usize);
assert!(offset_of!(TSMethodSignature, scope_id) == 36usize);

assert!(size_of::<TSConstructSignatureDeclaration>() == 24usize);
assert!(align_of::<TSConstructSignatureDeclaration>() == 4usize);
Expand Down Expand Up @@ -2553,13 +2553,13 @@ const _: () = {
assert!(size_of::<TSImportAttributeName>() == 20usize);
assert!(align_of::<TSImportAttributeName>() == 4usize);

assert!(size_of::<TSFunctionType>() == 48usize);
assert!(size_of::<TSFunctionType>() == 24usize);
assert!(align_of::<TSFunctionType>() == 4usize);
assert!(offset_of!(TSFunctionType, span) == 0usize);
assert!(offset_of!(TSFunctionType, this_param) == 8usize);
assert!(offset_of!(TSFunctionType, params) == 36usize);
assert!(offset_of!(TSFunctionType, return_type) == 40usize);
assert!(offset_of!(TSFunctionType, type_parameters) == 44usize);
assert!(offset_of!(TSFunctionType, params) == 12usize);
assert!(offset_of!(TSFunctionType, return_type) == 16usize);
assert!(offset_of!(TSFunctionType, type_parameters) == 20usize);

assert!(size_of::<TSConstructorType>() == 24usize);
assert!(align_of::<TSConstructorType>() == 4usize);
Expand Down
Loading

0 comments on commit 0f35d10

Please sign in to comment.