diff --git a/crates/oxc_ast/src/ast/ts.rs b/crates/oxc_ast/src/ast/ts.rs index c227a2b235c36..2a97f3033956e 100644 --- a/crates/oxc_ast/src/ast/ts.rs +++ b/crates/oxc_ast/src/ast/ts.rs @@ -1016,7 +1016,7 @@ pub struct TSCallSignatureDeclaration<'a> { pub span: Span, pub type_parameters: Option>>, #[estree(skip)] - pub this_param: Option>, + pub this_param: Option>>, #[estree(via = TSCallSignatureDeclarationFormalParameters)] pub params: Box<'a, FormalParameters<'a>>, pub return_type: Option>>, diff --git a/crates/oxc_ast/src/generated/assert_layouts.rs b/crates/oxc_ast/src/generated/assert_layouts.rs index 0e084c5bd44e9..be45f33776c56 100644 --- a/crates/oxc_ast/src/generated/assert_layouts.rs +++ b/crates/oxc_ast/src/generated/assert_layouts.rs @@ -1161,13 +1161,13 @@ const _: () = { assert!(offset_of!(TSIndexSignature, readonly) == 48); assert!(offset_of!(TSIndexSignature, r#static) == 49); - assert!(size_of::() == 64); + assert!(size_of::() == 40); assert!(align_of::() == 8); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 16); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 48); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 56); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 24); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 32); assert!(size_of::() == 1); assert!(align_of::() == 1); @@ -2554,13 +2554,13 @@ const _: () = { assert!(offset_of!(TSIndexSignature, readonly) == 28); assert!(offset_of!(TSIndexSignature, r#static) == 29); - assert!(size_of::() == 44); + assert!(size_of::() == 24); assert!(align_of::() == 4); assert!(offset_of!(TSCallSignatureDeclaration, span) == 0); assert!(offset_of!(TSCallSignatureDeclaration, type_parameters) == 8); assert!(offset_of!(TSCallSignatureDeclaration, this_param) == 12); - assert!(offset_of!(TSCallSignatureDeclaration, params) == 36); - assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 40); + assert!(offset_of!(TSCallSignatureDeclaration, params) == 16); + assert!(offset_of!(TSCallSignatureDeclaration, return_type) == 20); assert!(size_of::() == 1); assert!(align_of::() == 1); diff --git a/crates/oxc_ast/src/generated/ast_builder.rs b/crates/oxc_ast/src/generated/ast_builder.rs index 7515c12ee6a80..d4bf9e33602da 100644 --- a/crates/oxc_ast/src/generated/ast_builder.rs +++ b/crates/oxc_ast/src/generated/ast_builder.rs @@ -12388,18 +12388,19 @@ impl<'a> AstBuilder<'a> { /// * `params` /// * `return_type` #[inline] - pub fn ts_signature_call_signature_declaration( + pub fn ts_signature_call_signature_declaration( self, span: Span, type_parameters: T1, - this_param: Option>, - params: T2, - return_type: T3, + this_param: T2, + params: T3, + return_type: T4, ) -> TSSignature<'a> where T1: IntoIn<'a, Option>>>, - T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>, - T3: IntoIn<'a, Option>>>, + T2: IntoIn<'a, Option>>>, + T3: IntoIn<'a, Box<'a, FormalParameters<'a>>>, + T4: IntoIn<'a, Option>>>, { TSSignature::TSCallSignatureDeclaration(self.alloc_ts_call_signature_declaration( span, @@ -12643,23 +12644,24 @@ impl<'a> AstBuilder<'a> { /// * `params` /// * `return_type` #[inline] - pub fn ts_call_signature_declaration( + pub fn ts_call_signature_declaration( self, span: Span, type_parameters: T1, - this_param: Option>, - params: T2, - return_type: T3, + this_param: T2, + params: T3, + return_type: T4, ) -> TSCallSignatureDeclaration<'a> where T1: IntoIn<'a, Option>>>, - T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>, - T3: IntoIn<'a, Option>>>, + T2: IntoIn<'a, Option>>>, + T3: IntoIn<'a, Box<'a, FormalParameters<'a>>>, + T4: IntoIn<'a, Option>>>, { TSCallSignatureDeclaration { span, type_parameters: type_parameters.into_in(self.allocator), - this_param, + this_param: this_param.into_in(self.allocator), params: params.into_in(self.allocator), return_type: return_type.into_in(self.allocator), } @@ -12677,18 +12679,19 @@ impl<'a> AstBuilder<'a> { /// * `params` /// * `return_type` #[inline] - pub fn alloc_ts_call_signature_declaration( + pub fn alloc_ts_call_signature_declaration( self, span: Span, type_parameters: T1, - this_param: Option>, - params: T2, - return_type: T3, + this_param: T2, + params: T3, + return_type: T4, ) -> Box<'a, TSCallSignatureDeclaration<'a>> where T1: IntoIn<'a, Option>>>, - T2: IntoIn<'a, Box<'a, FormalParameters<'a>>>, - T3: IntoIn<'a, Option>>>, + T2: IntoIn<'a, Option>>>, + T3: IntoIn<'a, Box<'a, FormalParameters<'a>>>, + T4: IntoIn<'a, Option>>>, { Box::new_in( self.ts_call_signature_declaration( diff --git a/crates/oxc_ast/src/serialize.rs b/crates/oxc_ast/src/serialize.rs index 53729f3f083f1..f3c4fbcda6771 100644 --- a/crates/oxc_ast/src/serialize.rs +++ b/crates/oxc_ast/src/serialize.rs @@ -1206,7 +1206,7 @@ pub struct TSCallSignatureDeclarationFormalParameters<'a, 'b>( impl ESTree for TSCallSignatureDeclarationFormalParameters<'_, '_> { fn serialize(&self, serializer: S) { let v = self.0; - serialize_formal_params_with_this_param(v.this_param.as_ref(), &v.params, serializer); + serialize_formal_params_with_this_param(v.this_param.as_deref(), &v.params, serializer); } } diff --git a/crates/oxc_traverse/src/generated/ancestor.rs b/crates/oxc_traverse/src/generated/ancestor.rs index bf9fefd9053dd..f477068229876 100644 --- a/crates/oxc_traverse/src/generated/ancestor.rs +++ b/crates/oxc_traverse/src/generated/ancestor.rs @@ -13005,10 +13005,10 @@ impl<'a, 't> TSCallSignatureDeclarationWithoutTypeParameters<'a, 't> { } #[inline] - pub fn this_param(self) -> &'t Option> { + pub fn this_param(self) -> &'t Option>> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) + as *const Option>>) } } @@ -13107,10 +13107,10 @@ impl<'a, 't> TSCallSignatureDeclarationWithoutParams<'a, 't> { } #[inline] - pub fn this_param(self) -> &'t Option> { + pub fn this_param(self) -> &'t Option>> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) + as *const Option>>) } } @@ -13154,10 +13154,10 @@ impl<'a, 't> TSCallSignatureDeclarationWithoutReturnType<'a, 't> { } #[inline] - pub fn this_param(self) -> &'t Option> { + pub fn this_param(self) -> &'t Option>> { unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) + as *const Option>>) } } diff --git a/crates/oxc_traverse/src/generated/walk.rs b/crates/oxc_traverse/src/generated/walk.rs index bd791d9831f5a..8331f59464b43 100644 --- a/crates/oxc_traverse/src/generated/walk.rs +++ b/crates/oxc_traverse/src/generated/walk.rs @@ -4758,10 +4758,10 @@ unsafe fn walk_ts_call_signature_declaration<'a, Tr: Traverse<'a>>( } if let Some(field) = &mut *((node as *mut u8) .add(ancestor::OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *mut Option) + as *mut Option>) { ctx.retag_stack(AncestorType::TSCallSignatureDeclarationThisParam); - walk_ts_this_parameter(traverser, field as *mut _, ctx); + walk_ts_this_parameter(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSCallSignatureDeclarationParams); walk_formal_parameters( diff --git a/napi/parser/deserialize-js.js b/napi/parser/deserialize-js.js index 0b2e1d28dbbdb..bcac78ff48d41 100644 --- a/napi/parser/deserialize-js.js +++ b/napi/parser/deserialize-js.js @@ -1682,7 +1682,7 @@ function deserializeTSIndexSignature(pos) { } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 48); + const params = deserializeBoxFormalParameters(pos + 24); const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { @@ -1691,7 +1691,7 @@ function deserializeTSCallSignatureDeclaration(pos) { end: deserializeU32(pos + 4), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), }; } @@ -5492,11 +5492,6 @@ function deserializeVecTSIndexSignatureName(pos) { return arr; } -function deserializeOptionTSThisParameter(pos) { - if (uint8[pos] === 0) return null; - return deserializeTSThisParameter(pos + 8); -} - function deserializeOptionTSModuleDeclarationBody(pos) { if (uint8[pos] === 2) return null; return deserializeTSModuleDeclarationBody(pos); diff --git a/napi/parser/deserialize-ts.js b/napi/parser/deserialize-ts.js index 104bb1a15378d..5fefebf626475 100644 --- a/napi/parser/deserialize-ts.js +++ b/napi/parser/deserialize-ts.js @@ -1830,7 +1830,7 @@ function deserializeTSIndexSignature(pos) { } function deserializeTSCallSignatureDeclaration(pos) { - const params = deserializeBoxFormalParameters(pos + 48); + const params = deserializeBoxFormalParameters(pos + 24); const thisParam = deserializeOptionBoxTSThisParameter(pos + 16); if (thisParam !== null) params.unshift(thisParam); return { @@ -1839,7 +1839,7 @@ function deserializeTSCallSignatureDeclaration(pos) { end: deserializeU32(pos + 4), typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8), params, - returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56), + returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32), }; } @@ -5640,11 +5640,6 @@ function deserializeVecTSIndexSignatureName(pos) { return arr; } -function deserializeOptionTSThisParameter(pos) { - if (uint8[pos] === 0) return null; - return deserializeTSThisParameter(pos + 8); -} - function deserializeOptionTSModuleDeclarationBody(pos) { if (uint8[pos] === 2) return null; return deserializeTSModuleDeclarationBody(pos);