From c7945c2f0810563a4adbef831dfe0873b2a1b0eb Mon Sep 17 00:00:00 2001 From: Dunqing Date: Mon, 17 Feb 2025 00:50:51 +0800 Subject: [PATCH] refactor(traverse): simplify pointer manipulation and improve readability --- crates/oxc_traverse/scripts/lib/ancestor.mjs | 20 +- crates/oxc_traverse/scripts/lib/walk.mjs | 20 +- crates/oxc_traverse/src/generated/ancestor.rs | 4994 ++++------------- crates/oxc_traverse/src/generated/walk.rs | 1734 ++---- 4 files changed, 1424 insertions(+), 5344 deletions(-) diff --git a/crates/oxc_traverse/scripts/lib/ancestor.mjs b/crates/oxc_traverse/scripts/lib/ancestor.mjs index 25189899d31d2..9c848aaa20a2a 100644 --- a/crates/oxc_traverse/scripts/lib/ancestor.mjs +++ b/crates/oxc_traverse/scripts/lib/ancestor.mjs @@ -14,15 +14,7 @@ export default function generateAncestorsCode(types) { for (const type of Object.values(types)) { if (type.kind === 'enum') continue; - const typeSnakeName = camelToSnake(type.name), - typeScreamingName = typeSnakeName.toUpperCase(); - let offsetCode = ''; - for (const field of type.fields) { - const offsetVarName = `OFFSET_${typeScreamingName}_${field.name.toUpperCase()}`; - field.offsetVarName = offsetVarName; - offsetCode += `pub(crate) const ${offsetVarName}: usize = ` + - `offset_of!(${type.name}, ${field.rawName});\n`; - } + const typeSnakeName = camelToSnake(type.name); const variantNames = []; let thisAncestorTypes = ''; @@ -39,10 +31,7 @@ export default function generateAncestorsCode(types) { #[inline] pub fn ${otherField.rawName}(self) -> &'t ${otherField.rawTypeName} { unsafe { - &*( - (self.0 as *const u8).add(${otherField.offsetVarName}) - as *const ${otherField.rawTypeName} - ) + &*from_ref(&(*self.0).${otherField.rawName}) } } `; @@ -89,7 +78,6 @@ export default function generateAncestorsCode(types) { if (variantNames.length > 0) { ancestorTypes += ` - ${offsetCode} ${thisAncestorTypes} `; @@ -113,13 +101,11 @@ export default function generateAncestorsCode(types) { return ` #![expect( - clippy::ptr_as_ptr, clippy::undocumented_unsafe_blocks, - clippy::cast_ptr_alignment, clippy::needless_lifetimes )] - use std::{cell::Cell, marker::PhantomData, mem::offset_of}; + use std::{cell::Cell, marker::PhantomData, ptr::from_ref}; use oxc_allocator::{Address, Box, GetAddress, Vec}; use oxc_ast::ast::*; diff --git a/crates/oxc_traverse/scripts/lib/walk.mjs b/crates/oxc_traverse/scripts/lib/walk.mjs index 5e13df7a908be..9f676cd91995a 100644 --- a/crates/oxc_traverse/scripts/lib/walk.mjs +++ b/crates/oxc_traverse/scripts/lib/walk.mjs @@ -26,14 +26,12 @@ export default function generateWalkFunctionsCode(types) { clippy::semicolon_if_nothing_returned, clippy::ptr_as_ptr, clippy::ref_as_ptr, - clippy::cast_ptr_alignment )] - use std::{cell::Cell, marker::PhantomData}; + use std::{marker::PhantomData, ptr::from_mut}; use oxc_allocator::Vec; use oxc_ast::ast::*; - use oxc_syntax::scope::ScopeId; use crate::{ancestor::{self, AncestorType}, Ancestor, Traverse, TraverseCtx}; @@ -122,7 +120,7 @@ function generateWalkForStruct(type, types) { enterScopeCode = ` let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*(${makeFieldCode(scopeIdField)})).get().unwrap(); + let current_scope_id = ${makeFieldCode(scopeIdField)}.get().unwrap(); ctx.set_current_scope_id(current_scope_id); `; @@ -205,7 +203,7 @@ function generateWalkForStruct(type, types) { return ` ${scopeCode} ${tagCode} - if let Some(field) = &mut *(${fieldCode}) { + if let Some(field) = &mut ${fieldCode} { ${retagCode} ${walkCode} } @@ -216,18 +214,18 @@ function generateWalkForStruct(type, types) { let walkVecCode; if (field.wrappers.length === 1 && field.innerTypeName === 'Statement') { // Special case for `Vec` - walkVecCode = `walk_statements(traverser, ${fieldCode}, ctx);`; + walkVecCode = `walk_statements(traverser, from_mut(&mut ${fieldCode}), ctx);`; } else { let walkCode = `${fieldWalkName}(traverser, item as *mut _, ctx);`, iteratorCode = ''; if (field.wrappers.length === 2 && field.wrappers[1] === 'Option') { - iteratorCode = `(*(${fieldCode})).iter_mut().flatten()`; + iteratorCode = `${fieldCode}.iter_mut().flatten()`; } else { assert( field.wrappers.length === 1, `Cannot handle struct field with type ${field.type}`, ); - iteratorCode = `&mut *(${fieldCode})`; + iteratorCode = `&mut ${fieldCode}`; } walkVecCode = ` for item in ${iteratorCode} { @@ -247,7 +245,7 @@ function generateWalkForStruct(type, types) { return ` ${scopeCode} ${tagCode || retagCode} - ${fieldWalkName}(traverser, (&mut **(${fieldCode})) as *mut _, ctx); + ${fieldWalkName}(traverser, from_mut(&mut *(${fieldCode})), ctx); `; } @@ -256,7 +254,7 @@ function generateWalkForStruct(type, types) { return ` ${scopeCode} ${tagCode || retagCode} - ${fieldWalkName}(traverser, ${fieldCode}, ctx); + ${fieldWalkName}(traverser, from_mut(&mut ${fieldCode}), ctx); `; }); @@ -278,7 +276,7 @@ function generateWalkForStruct(type, types) { } function makeFieldCode(field) { - return `(node as *mut u8).add(ancestor::${field.offsetVarName}) as *mut ${field.typeName}`; + return `(*node).${field.name}`; } /** diff --git a/crates/oxc_traverse/src/generated/ancestor.rs b/crates/oxc_traverse/src/generated/ancestor.rs index 4e8dc8097c63d..d0a509cf63b0d 100644 --- a/crates/oxc_traverse/src/generated/ancestor.rs +++ b/crates/oxc_traverse/src/generated/ancestor.rs @@ -2,14 +2,9 @@ // Generated by `oxc_traverse/scripts/build.mjs`. // To alter this generated file you have to edit the codegen. -#![expect( - clippy::ptr_as_ptr, - clippy::undocumented_unsafe_blocks, - clippy::cast_ptr_alignment, - clippy::needless_lifetimes -)] +#![expect(clippy::undocumented_unsafe_blocks, clippy::needless_lifetimes)] -use std::{cell::Cell, marker::PhantomData, mem::offset_of}; +use std::{cell::Cell, marker::PhantomData, ptr::from_ref}; use oxc_allocator::{Address, Box, GetAddress, Vec}; use oxc_ast::ast::*; @@ -2492,15 +2487,6 @@ impl<'a, 't> GetAddress for Ancestor<'a, 't> { } } -pub(crate) const OFFSET_PROGRAM_SPAN: usize = offset_of!(Program, span); -pub(crate) const OFFSET_PROGRAM_SOURCE_TYPE: usize = offset_of!(Program, source_type); -pub(crate) const OFFSET_PROGRAM_SOURCE_TEXT: usize = offset_of!(Program, source_text); -pub(crate) const OFFSET_PROGRAM_COMMENTS: usize = offset_of!(Program, comments); -pub(crate) const OFFSET_PROGRAM_HASHBANG: usize = offset_of!(Program, hashbang); -pub(crate) const OFFSET_PROGRAM_DIRECTIVES: usize = offset_of!(Program, directives); -pub(crate) const OFFSET_PROGRAM_BODY: usize = offset_of!(Program, body); -pub(crate) const OFFSET_PROGRAM_SCOPE_ID: usize = offset_of!(Program, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ProgramWithoutHashbang<'a, 't>( @@ -2511,44 +2497,37 @@ pub struct ProgramWithoutHashbang<'a, 't>( impl<'a, 't> ProgramWithoutHashbang<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source_type(self) -> &'t SourceType { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TYPE) as *const SourceType) } + unsafe { &*from_ref(&(*self.0).source_type) } } #[inline] pub fn source_text(self) -> &'t &'a str { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TEXT) as *const &'a str) } + unsafe { &*from_ref(&(*self.0).source_text) } } #[inline] pub fn comments(self) -> &'t Vec<'a, Comment> { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_COMMENTS) as *const Vec<'a, Comment>) } + unsafe { &*from_ref(&(*self.0).comments) } } #[inline] pub fn directives(self) -> &'t Vec<'a, Directive<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_DIRECTIVES) - as *const Vec<'a, Directive<'a>>) - } + unsafe { &*from_ref(&(*self.0).directives) } } #[inline] pub fn body(self) -> &'t Vec<'a, Statement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_BODY) as *const Vec<'a, Statement<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -2569,43 +2548,37 @@ pub struct ProgramWithoutDirectives<'a, 't>( impl<'a, 't> ProgramWithoutDirectives<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source_type(self) -> &'t SourceType { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TYPE) as *const SourceType) } + unsafe { &*from_ref(&(*self.0).source_type) } } #[inline] pub fn source_text(self) -> &'t &'a str { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TEXT) as *const &'a str) } + unsafe { &*from_ref(&(*self.0).source_text) } } #[inline] pub fn comments(self) -> &'t Vec<'a, Comment> { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_COMMENTS) as *const Vec<'a, Comment>) } + unsafe { &*from_ref(&(*self.0).comments) } } #[inline] pub fn hashbang(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_HASHBANG) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).hashbang) } } #[inline] pub fn body(self) -> &'t Vec<'a, Statement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_BODY) as *const Vec<'a, Statement<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -2626,44 +2599,37 @@ pub struct ProgramWithoutBody<'a, 't>( impl<'a, 't> ProgramWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source_type(self) -> &'t SourceType { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TYPE) as *const SourceType) } + unsafe { &*from_ref(&(*self.0).source_type) } } #[inline] pub fn source_text(self) -> &'t &'a str { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_SOURCE_TEXT) as *const &'a str) } + unsafe { &*from_ref(&(*self.0).source_text) } } #[inline] pub fn comments(self) -> &'t Vec<'a, Comment> { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROGRAM_COMMENTS) as *const Vec<'a, Comment>) } + unsafe { &*from_ref(&(*self.0).comments) } } #[inline] pub fn hashbang(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_HASHBANG) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).hashbang) } } #[inline] pub fn directives(self) -> &'t Vec<'a, Directive<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_DIRECTIVES) - as *const Vec<'a, Directive<'a>>) - } + unsafe { &*from_ref(&(*self.0).directives) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROGRAM_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -2674,11 +2640,6 @@ impl<'a, 't> GetAddress for ProgramWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_ARRAY_EXPRESSION_SPAN: usize = offset_of!(ArrayExpression, span); -pub(crate) const OFFSET_ARRAY_EXPRESSION_ELEMENTS: usize = offset_of!(ArrayExpression, elements); -pub(crate) const OFFSET_ARRAY_EXPRESSION_TRAILING_COMMA: usize = - offset_of!(ArrayExpression, trailing_comma); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ArrayExpressionWithoutElements<'a, 't>( @@ -2689,15 +2650,12 @@ pub struct ArrayExpressionWithoutElements<'a, 't>( impl<'a, 't> ArrayExpressionWithoutElements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ARRAY_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn trailing_comma(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_EXPRESSION_TRAILING_COMMA) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).trailing_comma) } } } @@ -2708,12 +2666,6 @@ impl<'a, 't> GetAddress for ArrayExpressionWithoutElements<'a, 't> { } } -pub(crate) const OFFSET_OBJECT_EXPRESSION_SPAN: usize = offset_of!(ObjectExpression, span); -pub(crate) const OFFSET_OBJECT_EXPRESSION_PROPERTIES: usize = - offset_of!(ObjectExpression, properties); -pub(crate) const OFFSET_OBJECT_EXPRESSION_TRAILING_COMMA: usize = - offset_of!(ObjectExpression, trailing_comma); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ObjectExpressionWithoutProperties<'a, 't>( @@ -2724,15 +2676,12 @@ pub struct ObjectExpressionWithoutProperties<'a, 't>( impl<'a, 't> ObjectExpressionWithoutProperties<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn trailing_comma(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_EXPRESSION_TRAILING_COMMA) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).trailing_comma) } } } @@ -2743,14 +2692,6 @@ impl<'a, 't> GetAddress for ObjectExpressionWithoutProperties<'a, 't> { } } -pub(crate) const OFFSET_OBJECT_PROPERTY_SPAN: usize = offset_of!(ObjectProperty, span); -pub(crate) const OFFSET_OBJECT_PROPERTY_KIND: usize = offset_of!(ObjectProperty, kind); -pub(crate) const OFFSET_OBJECT_PROPERTY_KEY: usize = offset_of!(ObjectProperty, key); -pub(crate) const OFFSET_OBJECT_PROPERTY_VALUE: usize = offset_of!(ObjectProperty, value); -pub(crate) const OFFSET_OBJECT_PROPERTY_METHOD: usize = offset_of!(ObjectProperty, method); -pub(crate) const OFFSET_OBJECT_PROPERTY_SHORTHAND: usize = offset_of!(ObjectProperty, shorthand); -pub(crate) const OFFSET_OBJECT_PROPERTY_COMPUTED: usize = offset_of!(ObjectProperty, computed); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ObjectPropertyWithoutKey<'a, 't>( @@ -2761,34 +2702,32 @@ pub struct ObjectPropertyWithoutKey<'a, 't>( impl<'a, 't> ObjectPropertyWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t PropertyKind { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_KIND) as *const PropertyKind) } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn value(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_VALUE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn method(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_METHOD) as *const bool) } + unsafe { &*from_ref(&(*self.0).method) } } #[inline] pub fn shorthand(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_SHORTHAND) as *const bool) } + unsafe { &*from_ref(&(*self.0).shorthand) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -2809,34 +2748,32 @@ pub struct ObjectPropertyWithoutValue<'a, 't>( impl<'a, 't> ObjectPropertyWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t PropertyKind { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_KIND) as *const PropertyKind) } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn method(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_METHOD) as *const bool) } + unsafe { &*from_ref(&(*self.0).method) } } #[inline] pub fn shorthand(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_SHORTHAND) as *const bool) } + unsafe { &*from_ref(&(*self.0).shorthand) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -2847,11 +2784,6 @@ impl<'a, 't> GetAddress for ObjectPropertyWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_TEMPLATE_LITERAL_SPAN: usize = offset_of!(TemplateLiteral, span); -pub(crate) const OFFSET_TEMPLATE_LITERAL_QUASIS: usize = offset_of!(TemplateLiteral, quasis); -pub(crate) const OFFSET_TEMPLATE_LITERAL_EXPRESSIONS: usize = - offset_of!(TemplateLiteral, expressions); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TemplateLiteralWithoutQuasis<'a, 't>( @@ -2862,15 +2794,12 @@ pub struct TemplateLiteralWithoutQuasis<'a, 't>( impl<'a, 't> TemplateLiteralWithoutQuasis<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TEMPLATE_LITERAL_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expressions(self) -> &'t Vec<'a, Expression<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TEMPLATE_LITERAL_EXPRESSIONS) - as *const Vec<'a, Expression<'a>>) - } + unsafe { &*from_ref(&(*self.0).expressions) } } } @@ -2891,15 +2820,12 @@ pub struct TemplateLiteralWithoutExpressions<'a, 't>( impl<'a, 't> TemplateLiteralWithoutExpressions<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TEMPLATE_LITERAL_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn quasis(self) -> &'t Vec<'a, TemplateElement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TEMPLATE_LITERAL_QUASIS) - as *const Vec<'a, TemplateElement<'a>>) - } + unsafe { &*from_ref(&(*self.0).quasis) } } } @@ -2910,15 +2836,6 @@ impl<'a, 't> GetAddress for TemplateLiteralWithoutExpressions<'a, 't> { } } -pub(crate) const OFFSET_TAGGED_TEMPLATE_EXPRESSION_SPAN: usize = - offset_of!(TaggedTemplateExpression, span); -pub(crate) const OFFSET_TAGGED_TEMPLATE_EXPRESSION_TAG: usize = - offset_of!(TaggedTemplateExpression, tag); -pub(crate) const OFFSET_TAGGED_TEMPLATE_EXPRESSION_QUASI: usize = - offset_of!(TaggedTemplateExpression, quasi); -pub(crate) const OFFSET_TAGGED_TEMPLATE_EXPRESSION_TYPE_PARAMETERS: usize = - offset_of!(TaggedTemplateExpression, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TaggedTemplateExpressionWithoutTag<'a, 't>( @@ -2929,25 +2846,17 @@ pub struct TaggedTemplateExpressionWithoutTag<'a, 't>( impl<'a, 't> TaggedTemplateExpressionWithoutTag<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn quasi(self) -> &'t TemplateLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_QUASI) - as *const TemplateLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).quasi) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -2968,25 +2877,17 @@ pub struct TaggedTemplateExpressionWithoutQuasi<'a, 't>( impl<'a, 't> TaggedTemplateExpressionWithoutQuasi<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn tag(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_TAG) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).tag) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -3007,25 +2908,17 @@ pub struct TaggedTemplateExpressionWithoutTypeParameters<'a, 't>( impl<'a, 't> TaggedTemplateExpressionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn tag(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_TAG) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).tag) } } #[inline] pub fn quasi(self) -> &'t TemplateLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TAGGED_TEMPLATE_EXPRESSION_QUASI) - as *const TemplateLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).quasi) } } } @@ -3036,15 +2929,6 @@ impl<'a, 't> GetAddress for TaggedTemplateExpressionWithoutTypeParameters<'a, 't } } -pub(crate) const OFFSET_COMPUTED_MEMBER_EXPRESSION_SPAN: usize = - offset_of!(ComputedMemberExpression, span); -pub(crate) const OFFSET_COMPUTED_MEMBER_EXPRESSION_OBJECT: usize = - offset_of!(ComputedMemberExpression, object); -pub(crate) const OFFSET_COMPUTED_MEMBER_EXPRESSION_EXPRESSION: usize = - offset_of!(ComputedMemberExpression, expression); -pub(crate) const OFFSET_COMPUTED_MEMBER_EXPRESSION_OPTIONAL: usize = - offset_of!(ComputedMemberExpression, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ComputedMemberExpressionWithoutObject<'a, 't>( @@ -3055,24 +2939,17 @@ pub struct ComputedMemberExpressionWithoutObject<'a, 't>( impl<'a, 't> ComputedMemberExpressionWithoutObject<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3093,24 +2970,17 @@ pub struct ComputedMemberExpressionWithoutExpression<'a, 't>( impl<'a, 't> ComputedMemberExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_OBJECT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).object) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_COMPUTED_MEMBER_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3121,15 +2991,6 @@ impl<'a, 't> GetAddress for ComputedMemberExpressionWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_STATIC_MEMBER_EXPRESSION_SPAN: usize = - offset_of!(StaticMemberExpression, span); -pub(crate) const OFFSET_STATIC_MEMBER_EXPRESSION_OBJECT: usize = - offset_of!(StaticMemberExpression, object); -pub(crate) const OFFSET_STATIC_MEMBER_EXPRESSION_PROPERTY: usize = - offset_of!(StaticMemberExpression, property); -pub(crate) const OFFSET_STATIC_MEMBER_EXPRESSION_OPTIONAL: usize = - offset_of!(StaticMemberExpression, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct StaticMemberExpressionWithoutObject<'a, 't>( @@ -3140,24 +3001,17 @@ pub struct StaticMemberExpressionWithoutObject<'a, 't>( impl<'a, 't> StaticMemberExpressionWithoutObject<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn property(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_PROPERTY) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).property) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3178,24 +3032,17 @@ pub struct StaticMemberExpressionWithoutProperty<'a, 't>( impl<'a, 't> StaticMemberExpressionWithoutProperty<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_OBJECT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).object) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_MEMBER_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3206,15 +3053,6 @@ impl<'a, 't> GetAddress for StaticMemberExpressionWithoutProperty<'a, 't> { } } -pub(crate) const OFFSET_PRIVATE_FIELD_EXPRESSION_SPAN: usize = - offset_of!(PrivateFieldExpression, span); -pub(crate) const OFFSET_PRIVATE_FIELD_EXPRESSION_OBJECT: usize = - offset_of!(PrivateFieldExpression, object); -pub(crate) const OFFSET_PRIVATE_FIELD_EXPRESSION_FIELD: usize = - offset_of!(PrivateFieldExpression, field); -pub(crate) const OFFSET_PRIVATE_FIELD_EXPRESSION_OPTIONAL: usize = - offset_of!(PrivateFieldExpression, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct PrivateFieldExpressionWithoutObject<'a, 't>( @@ -3225,24 +3063,17 @@ pub struct PrivateFieldExpressionWithoutObject<'a, 't>( impl<'a, 't> PrivateFieldExpressionWithoutObject<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn field(self) -> &'t PrivateIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_FIELD) - as *const PrivateIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).field) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3263,24 +3094,17 @@ pub struct PrivateFieldExpressionWithoutField<'a, 't>( impl<'a, 't> PrivateFieldExpressionWithoutField<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_OBJECT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).object) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_FIELD_EXPRESSION_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3291,13 +3115,6 @@ impl<'a, 't> GetAddress for PrivateFieldExpressionWithoutField<'a, 't> { } } -pub(crate) const OFFSET_CALL_EXPRESSION_SPAN: usize = offset_of!(CallExpression, span); -pub(crate) const OFFSET_CALL_EXPRESSION_CALLEE: usize = offset_of!(CallExpression, callee); -pub(crate) const OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS: usize = - offset_of!(CallExpression, type_parameters); -pub(crate) const OFFSET_CALL_EXPRESSION_ARGUMENTS: usize = offset_of!(CallExpression, arguments); -pub(crate) const OFFSET_CALL_EXPRESSION_OPTIONAL: usize = offset_of!(CallExpression, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct CallExpressionWithoutCallee<'a, 't>( @@ -3308,28 +3125,22 @@ pub struct CallExpressionWithoutCallee<'a, 't>( impl<'a, 't> CallExpressionWithoutCallee<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn arguments(self) -> &'t Vec<'a, Argument<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS) - as *const Vec<'a, Argument<'a>>) - } + unsafe { &*from_ref(&(*self.0).arguments) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3350,27 +3161,22 @@ pub struct CallExpressionWithoutTypeParameters<'a, 't>( impl<'a, 't> CallExpressionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn callee(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_CALLEE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).callee) } } #[inline] pub fn arguments(self) -> &'t Vec<'a, Argument<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_ARGUMENTS) - as *const Vec<'a, Argument<'a>>) - } + unsafe { &*from_ref(&(*self.0).arguments) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3391,27 +3197,22 @@ pub struct CallExpressionWithoutArguments<'a, 't>( impl<'a, 't> CallExpressionWithoutArguments<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn callee(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_CALLEE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).callee) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CALL_EXPRESSION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -3422,12 +3223,6 @@ impl<'a, 't> GetAddress for CallExpressionWithoutArguments<'a, 't> { } } -pub(crate) const OFFSET_NEW_EXPRESSION_SPAN: usize = offset_of!(NewExpression, span); -pub(crate) const OFFSET_NEW_EXPRESSION_CALLEE: usize = offset_of!(NewExpression, callee); -pub(crate) const OFFSET_NEW_EXPRESSION_ARGUMENTS: usize = offset_of!(NewExpression, arguments); -pub(crate) const OFFSET_NEW_EXPRESSION_TYPE_PARAMETERS: usize = - offset_of!(NewExpression, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct NewExpressionWithoutCallee<'a, 't>( @@ -3438,23 +3233,17 @@ pub struct NewExpressionWithoutCallee<'a, 't>( impl<'a, 't> NewExpressionWithoutCallee<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn arguments(self) -> &'t Vec<'a, Argument<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_ARGUMENTS) - as *const Vec<'a, Argument<'a>>) - } + unsafe { &*from_ref(&(*self.0).arguments) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -3475,22 +3264,17 @@ pub struct NewExpressionWithoutArguments<'a, 't>( impl<'a, 't> NewExpressionWithoutArguments<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn callee(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_CALLEE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).callee) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -3511,22 +3295,17 @@ pub struct NewExpressionWithoutTypeParameters<'a, 't>( impl<'a, 't> NewExpressionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn callee(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_CALLEE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).callee) } } #[inline] pub fn arguments(self) -> &'t Vec<'a, Argument<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_NEW_EXPRESSION_ARGUMENTS) - as *const Vec<'a, Argument<'a>>) - } + unsafe { &*from_ref(&(*self.0).arguments) } } } @@ -3537,10 +3316,6 @@ impl<'a, 't> GetAddress for NewExpressionWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_META_PROPERTY_SPAN: usize = offset_of!(MetaProperty, span); -pub(crate) const OFFSET_META_PROPERTY_META: usize = offset_of!(MetaProperty, meta); -pub(crate) const OFFSET_META_PROPERTY_PROPERTY: usize = offset_of!(MetaProperty, property); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct MetaPropertyWithoutMeta<'a, 't>( @@ -3551,15 +3326,12 @@ pub struct MetaPropertyWithoutMeta<'a, 't>( impl<'a, 't> MetaPropertyWithoutMeta<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_META_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn property(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_META_PROPERTY_PROPERTY) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).property) } } } @@ -3580,14 +3352,12 @@ pub struct MetaPropertyWithoutProperty<'a, 't>( impl<'a, 't> MetaPropertyWithoutProperty<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_META_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn meta(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_META_PROPERTY_META) as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).meta) } } } @@ -3598,9 +3368,6 @@ impl<'a, 't> GetAddress for MetaPropertyWithoutProperty<'a, 't> { } } -pub(crate) const OFFSET_SPREAD_ELEMENT_SPAN: usize = offset_of!(SpreadElement, span); -pub(crate) const OFFSET_SPREAD_ELEMENT_ARGUMENT: usize = offset_of!(SpreadElement, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct SpreadElementWithoutArgument<'a, 't>( @@ -3611,7 +3378,7 @@ pub struct SpreadElementWithoutArgument<'a, 't>( impl<'a, 't> SpreadElementWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SPREAD_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -3622,11 +3389,6 @@ impl<'a, 't> GetAddress for SpreadElementWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_UPDATE_EXPRESSION_SPAN: usize = offset_of!(UpdateExpression, span); -pub(crate) const OFFSET_UPDATE_EXPRESSION_OPERATOR: usize = offset_of!(UpdateExpression, operator); -pub(crate) const OFFSET_UPDATE_EXPRESSION_PREFIX: usize = offset_of!(UpdateExpression, prefix); -pub(crate) const OFFSET_UPDATE_EXPRESSION_ARGUMENT: usize = offset_of!(UpdateExpression, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct UpdateExpressionWithoutArgument<'a, 't>( @@ -3637,20 +3399,17 @@ pub struct UpdateExpressionWithoutArgument<'a, 't>( impl<'a, 't> UpdateExpressionWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_UPDATE_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t UpdateOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_UPDATE_EXPRESSION_OPERATOR) - as *const UpdateOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } #[inline] pub fn prefix(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_UPDATE_EXPRESSION_PREFIX) as *const bool) } + unsafe { &*from_ref(&(*self.0).prefix) } } } @@ -3661,10 +3420,6 @@ impl<'a, 't> GetAddress for UpdateExpressionWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_UNARY_EXPRESSION_SPAN: usize = offset_of!(UnaryExpression, span); -pub(crate) const OFFSET_UNARY_EXPRESSION_OPERATOR: usize = offset_of!(UnaryExpression, operator); -pub(crate) const OFFSET_UNARY_EXPRESSION_ARGUMENT: usize = offset_of!(UnaryExpression, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct UnaryExpressionWithoutArgument<'a, 't>( @@ -3675,14 +3430,12 @@ pub struct UnaryExpressionWithoutArgument<'a, 't>( impl<'a, 't> UnaryExpressionWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_UNARY_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t UnaryOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_UNARY_EXPRESSION_OPERATOR) as *const UnaryOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } } @@ -3693,11 +3446,6 @@ impl<'a, 't> GetAddress for UnaryExpressionWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_BINARY_EXPRESSION_SPAN: usize = offset_of!(BinaryExpression, span); -pub(crate) const OFFSET_BINARY_EXPRESSION_LEFT: usize = offset_of!(BinaryExpression, left); -pub(crate) const OFFSET_BINARY_EXPRESSION_OPERATOR: usize = offset_of!(BinaryExpression, operator); -pub(crate) const OFFSET_BINARY_EXPRESSION_RIGHT: usize = offset_of!(BinaryExpression, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BinaryExpressionWithoutLeft<'a, 't>( @@ -3708,22 +3456,17 @@ pub struct BinaryExpressionWithoutLeft<'a, 't>( impl<'a, 't> BinaryExpressionWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t BinaryOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_OPERATOR) - as *const BinaryOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -3744,22 +3487,17 @@ pub struct BinaryExpressionWithoutRight<'a, 't>( impl<'a, 't> BinaryExpressionWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_LEFT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn operator(self) -> &'t BinaryOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINARY_EXPRESSION_OPERATOR) - as *const BinaryOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } } @@ -3770,10 +3508,6 @@ impl<'a, 't> GetAddress for BinaryExpressionWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_PRIVATE_IN_EXPRESSION_SPAN: usize = offset_of!(PrivateInExpression, span); -pub(crate) const OFFSET_PRIVATE_IN_EXPRESSION_LEFT: usize = offset_of!(PrivateInExpression, left); -pub(crate) const OFFSET_PRIVATE_IN_EXPRESSION_RIGHT: usize = offset_of!(PrivateInExpression, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct PrivateInExpressionWithoutLeft<'a, 't>( @@ -3784,15 +3518,12 @@ pub struct PrivateInExpressionWithoutLeft<'a, 't>( impl<'a, 't> PrivateInExpressionWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PRIVATE_IN_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_IN_EXPRESSION_RIGHT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -3813,15 +3544,12 @@ pub struct PrivateInExpressionWithoutRight<'a, 't>( impl<'a, 't> PrivateInExpressionWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PRIVATE_IN_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t PrivateIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PRIVATE_IN_EXPRESSION_LEFT) - as *const PrivateIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } } @@ -3832,12 +3560,6 @@ impl<'a, 't> GetAddress for PrivateInExpressionWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_LOGICAL_EXPRESSION_SPAN: usize = offset_of!(LogicalExpression, span); -pub(crate) const OFFSET_LOGICAL_EXPRESSION_LEFT: usize = offset_of!(LogicalExpression, left); -pub(crate) const OFFSET_LOGICAL_EXPRESSION_OPERATOR: usize = - offset_of!(LogicalExpression, operator); -pub(crate) const OFFSET_LOGICAL_EXPRESSION_RIGHT: usize = offset_of!(LogicalExpression, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct LogicalExpressionWithoutLeft<'a, 't>( @@ -3848,22 +3570,17 @@ pub struct LogicalExpressionWithoutLeft<'a, 't>( impl<'a, 't> LogicalExpressionWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t LogicalOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_OPERATOR) - as *const LogicalOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -3884,22 +3601,17 @@ pub struct LogicalExpressionWithoutRight<'a, 't>( impl<'a, 't> LogicalExpressionWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_LEFT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn operator(self) -> &'t LogicalOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LOGICAL_EXPRESSION_OPERATOR) - as *const LogicalOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } } @@ -3910,15 +3622,6 @@ impl<'a, 't> GetAddress for LogicalExpressionWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_CONDITIONAL_EXPRESSION_SPAN: usize = - offset_of!(ConditionalExpression, span); -pub(crate) const OFFSET_CONDITIONAL_EXPRESSION_TEST: usize = - offset_of!(ConditionalExpression, test); -pub(crate) const OFFSET_CONDITIONAL_EXPRESSION_CONSEQUENT: usize = - offset_of!(ConditionalExpression, consequent); -pub(crate) const OFFSET_CONDITIONAL_EXPRESSION_ALTERNATE: usize = - offset_of!(ConditionalExpression, alternate); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ConditionalExpressionWithoutTest<'a, 't>( @@ -3929,23 +3632,17 @@ pub struct ConditionalExpressionWithoutTest<'a, 't>( impl<'a, 't> ConditionalExpressionWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn consequent(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_CONSEQUENT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).consequent) } } #[inline] pub fn alternate(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_ALTERNATE) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).alternate) } } } @@ -3966,23 +3663,17 @@ pub struct ConditionalExpressionWithoutConsequent<'a, 't>( impl<'a, 't> ConditionalExpressionWithoutConsequent<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_TEST) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn alternate(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_ALTERNATE) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).alternate) } } } @@ -4003,23 +3694,17 @@ pub struct ConditionalExpressionWithoutAlternate<'a, 't>( impl<'a, 't> ConditionalExpressionWithoutAlternate<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_TEST) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn consequent(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CONDITIONAL_EXPRESSION_CONSEQUENT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).consequent) } } } @@ -4030,13 +3715,6 @@ impl<'a, 't> GetAddress for ConditionalExpressionWithoutAlternate<'a, 't> { } } -pub(crate) const OFFSET_ASSIGNMENT_EXPRESSION_SPAN: usize = offset_of!(AssignmentExpression, span); -pub(crate) const OFFSET_ASSIGNMENT_EXPRESSION_OPERATOR: usize = - offset_of!(AssignmentExpression, operator); -pub(crate) const OFFSET_ASSIGNMENT_EXPRESSION_LEFT: usize = offset_of!(AssignmentExpression, left); -pub(crate) const OFFSET_ASSIGNMENT_EXPRESSION_RIGHT: usize = - offset_of!(AssignmentExpression, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentExpressionWithoutLeft<'a, 't>( @@ -4047,23 +3725,17 @@ pub struct AssignmentExpressionWithoutLeft<'a, 't>( impl<'a, 't> AssignmentExpressionWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t AssignmentOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_OPERATOR) - as *const AssignmentOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_RIGHT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -4084,23 +3756,17 @@ pub struct AssignmentExpressionWithoutRight<'a, 't>( impl<'a, 't> AssignmentExpressionWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t AssignmentOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_OPERATOR) - as *const AssignmentOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } #[inline] pub fn left(self) -> &'t AssignmentTarget<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_EXPRESSION_LEFT) - as *const AssignmentTarget<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } } @@ -4111,15 +3777,6 @@ impl<'a, 't> GetAddress for AssignmentExpressionWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_ARRAY_ASSIGNMENT_TARGET_SPAN: usize = - offset_of!(ArrayAssignmentTarget, span); -pub(crate) const OFFSET_ARRAY_ASSIGNMENT_TARGET_ELEMENTS: usize = - offset_of!(ArrayAssignmentTarget, elements); -pub(crate) const OFFSET_ARRAY_ASSIGNMENT_TARGET_REST: usize = - offset_of!(ArrayAssignmentTarget, rest); -pub(crate) const OFFSET_ARRAY_ASSIGNMENT_TARGET_TRAILING_COMMA: usize = - offset_of!(ArrayAssignmentTarget, trailing_comma); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ArrayAssignmentTargetWithoutElements<'a, 't>( @@ -4130,23 +3787,17 @@ pub struct ArrayAssignmentTargetWithoutElements<'a, 't>( impl<'a, 't> ArrayAssignmentTargetWithoutElements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn rest(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_REST) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).rest) } } #[inline] pub fn trailing_comma(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_TRAILING_COMMA) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).trailing_comma) } } } @@ -4167,23 +3818,17 @@ pub struct ArrayAssignmentTargetWithoutRest<'a, 't>( impl<'a, 't> ArrayAssignmentTargetWithoutRest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn elements(self) -> &'t Vec<'a, Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_ELEMENTS) - as *const Vec<'a, Option>>) - } + unsafe { &*from_ref(&(*self.0).elements) } } #[inline] pub fn trailing_comma(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_ASSIGNMENT_TARGET_TRAILING_COMMA) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).trailing_comma) } } } @@ -4194,13 +3839,6 @@ impl<'a, 't> GetAddress for ArrayAssignmentTargetWithoutRest<'a, 't> { } } -pub(crate) const OFFSET_OBJECT_ASSIGNMENT_TARGET_SPAN: usize = - offset_of!(ObjectAssignmentTarget, span); -pub(crate) const OFFSET_OBJECT_ASSIGNMENT_TARGET_PROPERTIES: usize = - offset_of!(ObjectAssignmentTarget, properties); -pub(crate) const OFFSET_OBJECT_ASSIGNMENT_TARGET_REST: usize = - offset_of!(ObjectAssignmentTarget, rest); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ObjectAssignmentTargetWithoutProperties<'a, 't>( @@ -4211,17 +3849,12 @@ pub struct ObjectAssignmentTargetWithoutProperties<'a, 't>( impl<'a, 't> ObjectAssignmentTargetWithoutProperties<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_ASSIGNMENT_TARGET_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn rest(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_ASSIGNMENT_TARGET_REST) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).rest) } } } @@ -4242,17 +3875,12 @@ pub struct ObjectAssignmentTargetWithoutRest<'a, 't>( impl<'a, 't> ObjectAssignmentTargetWithoutRest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_ASSIGNMENT_TARGET_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn properties(self) -> &'t Vec<'a, AssignmentTargetProperty<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_ASSIGNMENT_TARGET_PROPERTIES) - as *const Vec<'a, AssignmentTargetProperty<'a>>) - } + unsafe { &*from_ref(&(*self.0).properties) } } } @@ -4263,10 +3891,6 @@ impl<'a, 't> GetAddress for ObjectAssignmentTargetWithoutRest<'a, 't> { } } -pub(crate) const OFFSET_ASSIGNMENT_TARGET_REST_SPAN: usize = offset_of!(AssignmentTargetRest, span); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_REST_TARGET: usize = - offset_of!(AssignmentTargetRest, target); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentTargetRestWithoutTarget<'a, 't>( @@ -4277,7 +3901,7 @@ pub struct AssignmentTargetRestWithoutTarget<'a, 't>( impl<'a, 't> AssignmentTargetRestWithoutTarget<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_REST_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4288,13 +3912,6 @@ impl<'a, 't> GetAddress for AssignmentTargetRestWithoutTarget<'a, 't> { } } -pub(crate) const OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_SPAN: usize = - offset_of!(AssignmentTargetWithDefault, span); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_BINDING: usize = - offset_of!(AssignmentTargetWithDefault, binding); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_INIT: usize = - offset_of!(AssignmentTargetWithDefault, init); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentTargetWithDefaultWithoutBinding<'a, 't>( @@ -4305,17 +3922,12 @@ pub struct AssignmentTargetWithDefaultWithoutBinding<'a, 't>( impl<'a, 't> AssignmentTargetWithDefaultWithoutBinding<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn init(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_INIT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).init) } } } @@ -4336,17 +3948,12 @@ pub struct AssignmentTargetWithDefaultWithoutInit<'a, 't>( impl<'a, 't> AssignmentTargetWithDefaultWithoutInit<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn binding(self) -> &'t AssignmentTarget<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_BINDING) - as *const AssignmentTarget<'a>) - } + unsafe { &*from_ref(&(*self.0).binding) } } } @@ -4357,13 +3964,6 @@ impl<'a, 't> GetAddress for AssignmentTargetWithDefaultWithoutInit<'a, 't> { } } -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_SPAN: usize = - offset_of!(AssignmentTargetPropertyIdentifier, span); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_BINDING: usize = - offset_of!(AssignmentTargetPropertyIdentifier, binding); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_INIT: usize = - offset_of!(AssignmentTargetPropertyIdentifier, init); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentTargetPropertyIdentifierWithoutBinding<'a, 't>( @@ -4374,18 +3974,12 @@ pub struct AssignmentTargetPropertyIdentifierWithoutBinding<'a, 't>( impl<'a, 't> AssignmentTargetPropertyIdentifierWithoutBinding<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn init(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_INIT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).init) } } } @@ -4406,18 +4000,12 @@ pub struct AssignmentTargetPropertyIdentifierWithoutInit<'a, 't>( impl<'a, 't> AssignmentTargetPropertyIdentifierWithoutInit<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn binding(self) -> &'t IdentifierReference<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_BINDING) - as *const IdentifierReference<'a>) - } + unsafe { &*from_ref(&(*self.0).binding) } } } @@ -4428,15 +4016,6 @@ impl<'a, 't> GetAddress for AssignmentTargetPropertyIdentifierWithoutInit<'a, 't } } -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_SPAN: usize = - offset_of!(AssignmentTargetPropertyProperty, span); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_NAME: usize = - offset_of!(AssignmentTargetPropertyProperty, name); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_BINDING: usize = - offset_of!(AssignmentTargetPropertyProperty, binding); -pub(crate) const OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_COMPUTED: usize = - offset_of!(AssignmentTargetPropertyProperty, computed); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentTargetPropertyPropertyWithoutName<'a, 't>( @@ -4447,26 +4026,17 @@ pub struct AssignmentTargetPropertyPropertyWithoutName<'a, 't>( impl<'a, 't> AssignmentTargetPropertyPropertyWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn binding(self) -> &'t AssignmentTargetMaybeDefault<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_BINDING) - as *const AssignmentTargetMaybeDefault<'a>) - } + unsafe { &*from_ref(&(*self.0).binding) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_COMPUTED) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -4487,26 +4057,17 @@ pub struct AssignmentTargetPropertyPropertyWithoutBinding<'a, 't>( impl<'a, 't> AssignmentTargetPropertyPropertyWithoutBinding<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_NAME) - as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_COMPUTED) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -4517,10 +4078,6 @@ impl<'a, 't> GetAddress for AssignmentTargetPropertyPropertyWithoutBinding<'a, ' } } -pub(crate) const OFFSET_SEQUENCE_EXPRESSION_SPAN: usize = offset_of!(SequenceExpression, span); -pub(crate) const OFFSET_SEQUENCE_EXPRESSION_EXPRESSIONS: usize = - offset_of!(SequenceExpression, expressions); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct SequenceExpressionWithoutExpressions<'a, 't>( @@ -4531,7 +4088,7 @@ pub struct SequenceExpressionWithoutExpressions<'a, 't>( impl<'a, 't> SequenceExpressionWithoutExpressions<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SEQUENCE_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4542,9 +4099,6 @@ impl<'a, 't> GetAddress for SequenceExpressionWithoutExpressions<'a, 't> { } } -pub(crate) const OFFSET_AWAIT_EXPRESSION_SPAN: usize = offset_of!(AwaitExpression, span); -pub(crate) const OFFSET_AWAIT_EXPRESSION_ARGUMENT: usize = offset_of!(AwaitExpression, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AwaitExpressionWithoutArgument<'a, 't>( @@ -4555,7 +4109,7 @@ pub struct AwaitExpressionWithoutArgument<'a, 't>( impl<'a, 't> AwaitExpressionWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_AWAIT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4566,10 +4120,6 @@ impl<'a, 't> GetAddress for AwaitExpressionWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_CHAIN_EXPRESSION_SPAN: usize = offset_of!(ChainExpression, span); -pub(crate) const OFFSET_CHAIN_EXPRESSION_EXPRESSION: usize = - offset_of!(ChainExpression, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ChainExpressionWithoutExpression<'a, 't>( @@ -4580,7 +4130,7 @@ pub struct ChainExpressionWithoutExpression<'a, 't>( impl<'a, 't> ChainExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CHAIN_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4591,11 +4141,6 @@ impl<'a, 't> GetAddress for ChainExpressionWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_PARENTHESIZED_EXPRESSION_SPAN: usize = - offset_of!(ParenthesizedExpression, span); -pub(crate) const OFFSET_PARENTHESIZED_EXPRESSION_EXPRESSION: usize = - offset_of!(ParenthesizedExpression, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ParenthesizedExpressionWithoutExpression<'a, 't>( @@ -4606,9 +4151,7 @@ pub struct ParenthesizedExpressionWithoutExpression<'a, 't>( impl<'a, 't> ParenthesizedExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PARENTHESIZED_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4619,10 +4162,6 @@ impl<'a, 't> GetAddress for ParenthesizedExpressionWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_DIRECTIVE_SPAN: usize = offset_of!(Directive, span); -pub(crate) const OFFSET_DIRECTIVE_EXPRESSION: usize = offset_of!(Directive, expression); -pub(crate) const OFFSET_DIRECTIVE_DIRECTIVE: usize = offset_of!(Directive, directive); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct DirectiveWithoutExpression<'a, 't>( @@ -4633,12 +4172,12 @@ pub struct DirectiveWithoutExpression<'a, 't>( impl<'a, 't> DirectiveWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_DIRECTIVE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn directive(self) -> &'t Atom<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_DIRECTIVE_DIRECTIVE) as *const Atom<'a>) } + unsafe { &*from_ref(&(*self.0).directive) } } } @@ -4649,10 +4188,6 @@ impl<'a, 't> GetAddress for DirectiveWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_BLOCK_STATEMENT_SPAN: usize = offset_of!(BlockStatement, span); -pub(crate) const OFFSET_BLOCK_STATEMENT_BODY: usize = offset_of!(BlockStatement, body); -pub(crate) const OFFSET_BLOCK_STATEMENT_SCOPE_ID: usize = offset_of!(BlockStatement, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BlockStatementWithoutBody<'a, 't>( @@ -4663,15 +4198,12 @@ pub struct BlockStatementWithoutBody<'a, 't>( impl<'a, 't> BlockStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BLOCK_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BLOCK_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -4682,13 +4214,6 @@ impl<'a, 't> GetAddress for BlockStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_VARIABLE_DECLARATION_SPAN: usize = offset_of!(VariableDeclaration, span); -pub(crate) const OFFSET_VARIABLE_DECLARATION_KIND: usize = offset_of!(VariableDeclaration, kind); -pub(crate) const OFFSET_VARIABLE_DECLARATION_DECLARATIONS: usize = - offset_of!(VariableDeclaration, declarations); -pub(crate) const OFFSET_VARIABLE_DECLARATION_DECLARE: usize = - offset_of!(VariableDeclaration, declare); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct VariableDeclarationWithoutDeclarations<'a, 't>( @@ -4699,20 +4224,17 @@ pub struct VariableDeclarationWithoutDeclarations<'a, 't>( impl<'a, 't> VariableDeclarationWithoutDeclarations<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t VariableDeclarationKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATION_KIND) - as *const VariableDeclarationKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } } @@ -4723,13 +4245,6 @@ impl<'a, 't> GetAddress for VariableDeclarationWithoutDeclarations<'a, 't> { } } -pub(crate) const OFFSET_VARIABLE_DECLARATOR_SPAN: usize = offset_of!(VariableDeclarator, span); -pub(crate) const OFFSET_VARIABLE_DECLARATOR_KIND: usize = offset_of!(VariableDeclarator, kind); -pub(crate) const OFFSET_VARIABLE_DECLARATOR_ID: usize = offset_of!(VariableDeclarator, id); -pub(crate) const OFFSET_VARIABLE_DECLARATOR_INIT: usize = offset_of!(VariableDeclarator, init); -pub(crate) const OFFSET_VARIABLE_DECLARATOR_DEFINITE: usize = - offset_of!(VariableDeclarator, definite); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct VariableDeclaratorWithoutId<'a, 't>( @@ -4740,28 +4255,22 @@ pub struct VariableDeclaratorWithoutId<'a, 't>( impl<'a, 't> VariableDeclaratorWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t VariableDeclarationKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_KIND) - as *const VariableDeclarationKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn init(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_INIT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).init) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } } @@ -4782,28 +4291,22 @@ pub struct VariableDeclaratorWithoutInit<'a, 't>( impl<'a, 't> VariableDeclaratorWithoutInit<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t VariableDeclarationKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_KIND) - as *const VariableDeclarationKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn id(self) -> &'t BindingPattern<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_ID) - as *const BindingPattern<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_VARIABLE_DECLARATOR_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } } @@ -4814,10 +4317,6 @@ impl<'a, 't> GetAddress for VariableDeclaratorWithoutInit<'a, 't> { } } -pub(crate) const OFFSET_EXPRESSION_STATEMENT_SPAN: usize = offset_of!(ExpressionStatement, span); -pub(crate) const OFFSET_EXPRESSION_STATEMENT_EXPRESSION: usize = - offset_of!(ExpressionStatement, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ExpressionStatementWithoutExpression<'a, 't>( @@ -4828,7 +4327,7 @@ pub struct ExpressionStatementWithoutExpression<'a, 't>( impl<'a, 't> ExpressionStatementWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPRESSION_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -4839,11 +4338,6 @@ impl<'a, 't> GetAddress for ExpressionStatementWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_IF_STATEMENT_SPAN: usize = offset_of!(IfStatement, span); -pub(crate) const OFFSET_IF_STATEMENT_TEST: usize = offset_of!(IfStatement, test); -pub(crate) const OFFSET_IF_STATEMENT_CONSEQUENT: usize = offset_of!(IfStatement, consequent); -pub(crate) const OFFSET_IF_STATEMENT_ALTERNATE: usize = offset_of!(IfStatement, alternate); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct IfStatementWithoutTest<'a, 't>( @@ -4854,22 +4348,17 @@ pub struct IfStatementWithoutTest<'a, 't>( impl<'a, 't> IfStatementWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn consequent(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_CONSEQUENT) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).consequent) } } #[inline] pub fn alternate(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_ALTERNATE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).alternate) } } } @@ -4890,20 +4379,17 @@ pub struct IfStatementWithoutConsequent<'a, 't>( impl<'a, 't> IfStatementWithoutConsequent<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_TEST) as *const Expression<'a>) } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn alternate(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_ALTERNATE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).alternate) } } } @@ -4924,19 +4410,17 @@ pub struct IfStatementWithoutAlternate<'a, 't>( impl<'a, 't> IfStatementWithoutAlternate<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_TEST) as *const Expression<'a>) } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn consequent(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IF_STATEMENT_CONSEQUENT) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).consequent) } } } @@ -4947,10 +4431,6 @@ impl<'a, 't> GetAddress for IfStatementWithoutAlternate<'a, 't> { } } -pub(crate) const OFFSET_DO_WHILE_STATEMENT_SPAN: usize = offset_of!(DoWhileStatement, span); -pub(crate) const OFFSET_DO_WHILE_STATEMENT_BODY: usize = offset_of!(DoWhileStatement, body); -pub(crate) const OFFSET_DO_WHILE_STATEMENT_TEST: usize = offset_of!(DoWhileStatement, test); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct DoWhileStatementWithoutBody<'a, 't>( @@ -4961,14 +4441,12 @@ pub struct DoWhileStatementWithoutBody<'a, 't>( impl<'a, 't> DoWhileStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_DO_WHILE_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_DO_WHILE_STATEMENT_TEST) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).test) } } } @@ -4989,14 +4467,12 @@ pub struct DoWhileStatementWithoutTest<'a, 't>( impl<'a, 't> DoWhileStatementWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_DO_WHILE_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_DO_WHILE_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } } @@ -5007,10 +4483,6 @@ impl<'a, 't> GetAddress for DoWhileStatementWithoutTest<'a, 't> { } } -pub(crate) const OFFSET_WHILE_STATEMENT_SPAN: usize = offset_of!(WhileStatement, span); -pub(crate) const OFFSET_WHILE_STATEMENT_TEST: usize = offset_of!(WhileStatement, test); -pub(crate) const OFFSET_WHILE_STATEMENT_BODY: usize = offset_of!(WhileStatement, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct WhileStatementWithoutTest<'a, 't>( @@ -5021,14 +4493,12 @@ pub struct WhileStatementWithoutTest<'a, 't>( impl<'a, 't> WhileStatementWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WHILE_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_WHILE_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } } @@ -5049,14 +4519,12 @@ pub struct WhileStatementWithoutBody<'a, 't>( impl<'a, 't> WhileStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WHILE_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_WHILE_STATEMENT_TEST) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).test) } } } @@ -5067,13 +4535,6 @@ impl<'a, 't> GetAddress for WhileStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_FOR_STATEMENT_SPAN: usize = offset_of!(ForStatement, span); -pub(crate) const OFFSET_FOR_STATEMENT_INIT: usize = offset_of!(ForStatement, init); -pub(crate) const OFFSET_FOR_STATEMENT_TEST: usize = offset_of!(ForStatement, test); -pub(crate) const OFFSET_FOR_STATEMENT_UPDATE: usize = offset_of!(ForStatement, update); -pub(crate) const OFFSET_FOR_STATEMENT_BODY: usize = offset_of!(ForStatement, body); -pub(crate) const OFFSET_FOR_STATEMENT_SCOPE_ID: usize = offset_of!(ForStatement, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ForStatementWithoutInit<'a, 't>( @@ -5084,36 +4545,27 @@ pub struct ForStatementWithoutInit<'a, 't>( impl<'a, 't> ForStatementWithoutInit<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_TEST) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn update(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_UPDATE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).update) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_BODY) as *const Statement<'a>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5134,36 +4586,27 @@ pub struct ForStatementWithoutTest<'a, 't>( impl<'a, 't> ForStatementWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn init(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_INIT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).init) } } #[inline] pub fn update(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_UPDATE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).update) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_BODY) as *const Statement<'a>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5184,36 +4627,27 @@ pub struct ForStatementWithoutUpdate<'a, 't>( impl<'a, 't> ForStatementWithoutUpdate<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn init(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_INIT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).init) } } #[inline] pub fn test(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_TEST) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_BODY) as *const Statement<'a>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5234,39 +4668,27 @@ pub struct ForStatementWithoutBody<'a, 't>( impl<'a, 't> ForStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn init(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_INIT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).init) } } #[inline] pub fn test(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_TEST) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).test) } } #[inline] pub fn update(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_UPDATE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).update) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5277,12 +4699,6 @@ impl<'a, 't> GetAddress for ForStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_FOR_IN_STATEMENT_SPAN: usize = offset_of!(ForInStatement, span); -pub(crate) const OFFSET_FOR_IN_STATEMENT_LEFT: usize = offset_of!(ForInStatement, left); -pub(crate) const OFFSET_FOR_IN_STATEMENT_RIGHT: usize = offset_of!(ForInStatement, right); -pub(crate) const OFFSET_FOR_IN_STATEMENT_BODY: usize = offset_of!(ForInStatement, body); -pub(crate) const OFFSET_FOR_IN_STATEMENT_SCOPE_ID: usize = offset_of!(ForInStatement, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ForInStatementWithoutLeft<'a, 't>( @@ -5293,29 +4709,22 @@ pub struct ForInStatementWithoutLeft<'a, 't>( impl<'a, 't> ForInStatementWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5336,30 +4745,22 @@ pub struct ForInStatementWithoutRight<'a, 't>( impl<'a, 't> ForInStatementWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t ForStatementLeft<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_LEFT) - as *const ForStatementLeft<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5380,30 +4781,22 @@ pub struct ForInStatementWithoutBody<'a, 't>( impl<'a, 't> ForInStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t ForStatementLeft<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_LEFT) - as *const ForStatementLeft<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_IN_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5414,13 +4807,6 @@ impl<'a, 't> GetAddress for ForInStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_FOR_OF_STATEMENT_SPAN: usize = offset_of!(ForOfStatement, span); -pub(crate) const OFFSET_FOR_OF_STATEMENT_AWAIT: usize = offset_of!(ForOfStatement, r#await); -pub(crate) const OFFSET_FOR_OF_STATEMENT_LEFT: usize = offset_of!(ForOfStatement, left); -pub(crate) const OFFSET_FOR_OF_STATEMENT_RIGHT: usize = offset_of!(ForOfStatement, right); -pub(crate) const OFFSET_FOR_OF_STATEMENT_BODY: usize = offset_of!(ForOfStatement, body); -pub(crate) const OFFSET_FOR_OF_STATEMENT_SCOPE_ID: usize = offset_of!(ForOfStatement, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ForOfStatementWithoutLeft<'a, 't>( @@ -5431,34 +4817,27 @@ pub struct ForOfStatementWithoutLeft<'a, 't>( impl<'a, 't> ForOfStatementWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#await(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_AWAIT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#await) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5479,35 +4858,27 @@ pub struct ForOfStatementWithoutRight<'a, 't>( impl<'a, 't> ForOfStatementWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#await(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_AWAIT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#await) } } #[inline] pub fn left(self) -> &'t ForStatementLeft<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_LEFT) - as *const ForStatementLeft<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5528,35 +4899,27 @@ pub struct ForOfStatementWithoutBody<'a, 't>( impl<'a, 't> ForOfStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#await(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_AWAIT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#await) } } #[inline] pub fn left(self) -> &'t ForStatementLeft<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_LEFT) - as *const ForStatementLeft<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FOR_OF_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5567,9 +4930,6 @@ impl<'a, 't> GetAddress for ForOfStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_CONTINUE_STATEMENT_SPAN: usize = offset_of!(ContinueStatement, span); -pub(crate) const OFFSET_CONTINUE_STATEMENT_LABEL: usize = offset_of!(ContinueStatement, label); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ContinueStatementWithoutLabel<'a, 't>( @@ -5580,7 +4940,7 @@ pub struct ContinueStatementWithoutLabel<'a, 't>( impl<'a, 't> ContinueStatementWithoutLabel<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CONTINUE_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -5591,9 +4951,6 @@ impl<'a, 't> GetAddress for ContinueStatementWithoutLabel<'a, 't> { } } -pub(crate) const OFFSET_BREAK_STATEMENT_SPAN: usize = offset_of!(BreakStatement, span); -pub(crate) const OFFSET_BREAK_STATEMENT_LABEL: usize = offset_of!(BreakStatement, label); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BreakStatementWithoutLabel<'a, 't>( @@ -5604,7 +4961,7 @@ pub struct BreakStatementWithoutLabel<'a, 't>( impl<'a, 't> BreakStatementWithoutLabel<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BREAK_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -5615,9 +4972,6 @@ impl<'a, 't> GetAddress for BreakStatementWithoutLabel<'a, 't> { } } -pub(crate) const OFFSET_RETURN_STATEMENT_SPAN: usize = offset_of!(ReturnStatement, span); -pub(crate) const OFFSET_RETURN_STATEMENT_ARGUMENT: usize = offset_of!(ReturnStatement, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ReturnStatementWithoutArgument<'a, 't>( @@ -5628,7 +4982,7 @@ pub struct ReturnStatementWithoutArgument<'a, 't>( impl<'a, 't> ReturnStatementWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_RETURN_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -5639,10 +4993,6 @@ impl<'a, 't> GetAddress for ReturnStatementWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_WITH_STATEMENT_SPAN: usize = offset_of!(WithStatement, span); -pub(crate) const OFFSET_WITH_STATEMENT_OBJECT: usize = offset_of!(WithStatement, object); -pub(crate) const OFFSET_WITH_STATEMENT_BODY: usize = offset_of!(WithStatement, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct WithStatementWithoutObject<'a, 't>( @@ -5653,12 +5003,12 @@ pub struct WithStatementWithoutObject<'a, 't>( impl<'a, 't> WithStatementWithoutObject<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WITH_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { &*((self.0 as *const u8).add(OFFSET_WITH_STATEMENT_BODY) as *const Statement<'a>) } + unsafe { &*from_ref(&(*self.0).body) } } } @@ -5679,14 +5029,12 @@ pub struct WithStatementWithoutBody<'a, 't>( impl<'a, 't> WithStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WITH_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_WITH_STATEMENT_OBJECT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).object) } } } @@ -5697,12 +5045,6 @@ impl<'a, 't> GetAddress for WithStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_SWITCH_STATEMENT_SPAN: usize = offset_of!(SwitchStatement, span); -pub(crate) const OFFSET_SWITCH_STATEMENT_DISCRIMINANT: usize = - offset_of!(SwitchStatement, discriminant); -pub(crate) const OFFSET_SWITCH_STATEMENT_CASES: usize = offset_of!(SwitchStatement, cases); -pub(crate) const OFFSET_SWITCH_STATEMENT_SCOPE_ID: usize = offset_of!(SwitchStatement, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct SwitchStatementWithoutDiscriminant<'a, 't>( @@ -5713,23 +5055,17 @@ pub struct SwitchStatementWithoutDiscriminant<'a, 't>( impl<'a, 't> SwitchStatementWithoutDiscriminant<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn cases(self) -> &'t Vec<'a, SwitchCase<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_CASES) - as *const Vec<'a, SwitchCase<'a>>) - } + unsafe { &*from_ref(&(*self.0).cases) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5750,23 +5086,17 @@ pub struct SwitchStatementWithoutCases<'a, 't>( impl<'a, 't> SwitchStatementWithoutCases<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn discriminant(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_DISCRIMINANT) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).discriminant) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_STATEMENT_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -5777,10 +5107,6 @@ impl<'a, 't> GetAddress for SwitchStatementWithoutCases<'a, 't> { } } -pub(crate) const OFFSET_SWITCH_CASE_SPAN: usize = offset_of!(SwitchCase, span); -pub(crate) const OFFSET_SWITCH_CASE_TEST: usize = offset_of!(SwitchCase, test); -pub(crate) const OFFSET_SWITCH_CASE_CONSEQUENT: usize = offset_of!(SwitchCase, consequent); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct SwitchCaseWithoutTest<'a, 't>( @@ -5791,15 +5117,12 @@ pub struct SwitchCaseWithoutTest<'a, 't>( impl<'a, 't> SwitchCaseWithoutTest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SWITCH_CASE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn consequent(self) -> &'t Vec<'a, Statement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_CASE_CONSEQUENT) - as *const Vec<'a, Statement<'a>>) - } + unsafe { &*from_ref(&(*self.0).consequent) } } } @@ -5820,14 +5143,12 @@ pub struct SwitchCaseWithoutConsequent<'a, 't>( impl<'a, 't> SwitchCaseWithoutConsequent<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_SWITCH_CASE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn test(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_SWITCH_CASE_TEST) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).test) } } } @@ -5838,10 +5159,6 @@ impl<'a, 't> GetAddress for SwitchCaseWithoutConsequent<'a, 't> { } } -pub(crate) const OFFSET_LABELED_STATEMENT_SPAN: usize = offset_of!(LabeledStatement, span); -pub(crate) const OFFSET_LABELED_STATEMENT_LABEL: usize = offset_of!(LabeledStatement, label); -pub(crate) const OFFSET_LABELED_STATEMENT_BODY: usize = offset_of!(LabeledStatement, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct LabeledStatementWithoutLabel<'a, 't>( @@ -5852,14 +5169,12 @@ pub struct LabeledStatementWithoutLabel<'a, 't>( impl<'a, 't> LabeledStatementWithoutLabel<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_LABELED_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Statement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LABELED_STATEMENT_BODY) as *const Statement<'a>) - } + unsafe { &*from_ref(&(*self.0).body) } } } @@ -5880,15 +5195,12 @@ pub struct LabeledStatementWithoutBody<'a, 't>( impl<'a, 't> LabeledStatementWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_LABELED_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn label(self) -> &'t LabelIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_LABELED_STATEMENT_LABEL) - as *const LabelIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).label) } } } @@ -5899,9 +5211,6 @@ impl<'a, 't> GetAddress for LabeledStatementWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_THROW_STATEMENT_SPAN: usize = offset_of!(ThrowStatement, span); -pub(crate) const OFFSET_THROW_STATEMENT_ARGUMENT: usize = offset_of!(ThrowStatement, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ThrowStatementWithoutArgument<'a, 't>( @@ -5912,7 +5221,7 @@ pub struct ThrowStatementWithoutArgument<'a, 't>( impl<'a, 't> ThrowStatementWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_THROW_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -5923,11 +5232,6 @@ impl<'a, 't> GetAddress for ThrowStatementWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_TRY_STATEMENT_SPAN: usize = offset_of!(TryStatement, span); -pub(crate) const OFFSET_TRY_STATEMENT_BLOCK: usize = offset_of!(TryStatement, block); -pub(crate) const OFFSET_TRY_STATEMENT_HANDLER: usize = offset_of!(TryStatement, handler); -pub(crate) const OFFSET_TRY_STATEMENT_FINALIZER: usize = offset_of!(TryStatement, finalizer); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TryStatementWithoutBlock<'a, 't>( @@ -5938,23 +5242,17 @@ pub struct TryStatementWithoutBlock<'a, 't>( impl<'a, 't> TryStatementWithoutBlock<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn handler(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_HANDLER) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).handler) } } #[inline] pub fn finalizer(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_FINALIZER) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).finalizer) } } } @@ -5975,23 +5273,17 @@ pub struct TryStatementWithoutHandler<'a, 't>( impl<'a, 't> TryStatementWithoutHandler<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn block(self) -> &'t Box<'a, BlockStatement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_BLOCK) - as *const Box<'a, BlockStatement<'a>>) - } + unsafe { &*from_ref(&(*self.0).block) } } #[inline] pub fn finalizer(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_FINALIZER) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).finalizer) } } } @@ -6012,23 +5304,17 @@ pub struct TryStatementWithoutFinalizer<'a, 't>( impl<'a, 't> TryStatementWithoutFinalizer<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn block(self) -> &'t Box<'a, BlockStatement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_BLOCK) - as *const Box<'a, BlockStatement<'a>>) - } + unsafe { &*from_ref(&(*self.0).block) } } #[inline] pub fn handler(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TRY_STATEMENT_HANDLER) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).handler) } } } @@ -6039,11 +5325,6 @@ impl<'a, 't> GetAddress for TryStatementWithoutFinalizer<'a, 't> { } } -pub(crate) const OFFSET_CATCH_CLAUSE_SPAN: usize = offset_of!(CatchClause, span); -pub(crate) const OFFSET_CATCH_CLAUSE_PARAM: usize = offset_of!(CatchClause, param); -pub(crate) const OFFSET_CATCH_CLAUSE_BODY: usize = offset_of!(CatchClause, body); -pub(crate) const OFFSET_CATCH_CLAUSE_SCOPE_ID: usize = offset_of!(CatchClause, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct CatchClauseWithoutParam<'a, 't>( @@ -6054,23 +5335,17 @@ pub struct CatchClauseWithoutParam<'a, 't>( impl<'a, 't> CatchClauseWithoutParam<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Box<'a, BlockStatement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_BODY) - as *const Box<'a, BlockStatement<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6091,23 +5366,17 @@ pub struct CatchClauseWithoutBody<'a, 't>( impl<'a, 't> CatchClauseWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn param(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_PARAM) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).param) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CATCH_CLAUSE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6118,9 +5387,6 @@ impl<'a, 't> GetAddress for CatchClauseWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_CATCH_PARAMETER_SPAN: usize = offset_of!(CatchParameter, span); -pub(crate) const OFFSET_CATCH_PARAMETER_PATTERN: usize = offset_of!(CatchParameter, pattern); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct CatchParameterWithoutPattern<'a, 't>( @@ -6131,7 +5397,7 @@ pub struct CatchParameterWithoutPattern<'a, 't>( impl<'a, 't> CatchParameterWithoutPattern<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CATCH_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -6142,11 +5408,6 @@ impl<'a, 't> GetAddress for CatchParameterWithoutPattern<'a, 't> { } } -pub(crate) const OFFSET_BINDING_PATTERN_KIND: usize = offset_of!(BindingPattern, kind); -pub(crate) const OFFSET_BINDING_PATTERN_TYPE_ANNOTATION: usize = - offset_of!(BindingPattern, type_annotation); -pub(crate) const OFFSET_BINDING_PATTERN_OPTIONAL: usize = offset_of!(BindingPattern, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BindingPatternWithoutKind<'a, 't>( @@ -6157,15 +5418,12 @@ pub struct BindingPatternWithoutKind<'a, 't>( impl<'a, 't> BindingPatternWithoutKind<'a, 't> { #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINDING_PATTERN_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PATTERN_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -6186,15 +5444,12 @@ pub struct BindingPatternWithoutTypeAnnotation<'a, 't>( impl<'a, 't> BindingPatternWithoutTypeAnnotation<'a, 't> { #[inline] pub fn kind(self) -> &'t BindingPatternKind<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINDING_PATTERN_KIND) - as *const BindingPatternKind<'a>) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PATTERN_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -6205,10 +5460,6 @@ impl<'a, 't> GetAddress for BindingPatternWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_ASSIGNMENT_PATTERN_SPAN: usize = offset_of!(AssignmentPattern, span); -pub(crate) const OFFSET_ASSIGNMENT_PATTERN_LEFT: usize = offset_of!(AssignmentPattern, left); -pub(crate) const OFFSET_ASSIGNMENT_PATTERN_RIGHT: usize = offset_of!(AssignmentPattern, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AssignmentPatternWithoutLeft<'a, 't>( @@ -6219,14 +5470,12 @@ pub struct AssignmentPatternWithoutLeft<'a, 't>( impl<'a, 't> AssignmentPatternWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn right(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_PATTERN_RIGHT) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -6247,15 +5496,12 @@ pub struct AssignmentPatternWithoutRight<'a, 't>( impl<'a, 't> AssignmentPatternWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t BindingPattern<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ASSIGNMENT_PATTERN_LEFT) - as *const BindingPattern<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } } @@ -6266,10 +5512,6 @@ impl<'a, 't> GetAddress for AssignmentPatternWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_OBJECT_PATTERN_SPAN: usize = offset_of!(ObjectPattern, span); -pub(crate) const OFFSET_OBJECT_PATTERN_PROPERTIES: usize = offset_of!(ObjectPattern, properties); -pub(crate) const OFFSET_OBJECT_PATTERN_REST: usize = offset_of!(ObjectPattern, rest); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ObjectPatternWithoutProperties<'a, 't>( @@ -6280,15 +5522,12 @@ pub struct ObjectPatternWithoutProperties<'a, 't>( impl<'a, 't> ObjectPatternWithoutProperties<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn rest(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_PATTERN_REST) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).rest) } } } @@ -6309,15 +5548,12 @@ pub struct ObjectPatternWithoutRest<'a, 't>( impl<'a, 't> ObjectPatternWithoutRest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_OBJECT_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn properties(self) -> &'t Vec<'a, BindingProperty<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_OBJECT_PATTERN_PROPERTIES) - as *const Vec<'a, BindingProperty<'a>>) - } + unsafe { &*from_ref(&(*self.0).properties) } } } @@ -6328,12 +5564,6 @@ impl<'a, 't> GetAddress for ObjectPatternWithoutRest<'a, 't> { } } -pub(crate) const OFFSET_BINDING_PROPERTY_SPAN: usize = offset_of!(BindingProperty, span); -pub(crate) const OFFSET_BINDING_PROPERTY_KEY: usize = offset_of!(BindingProperty, key); -pub(crate) const OFFSET_BINDING_PROPERTY_VALUE: usize = offset_of!(BindingProperty, value); -pub(crate) const OFFSET_BINDING_PROPERTY_SHORTHAND: usize = offset_of!(BindingProperty, shorthand); -pub(crate) const OFFSET_BINDING_PROPERTY_COMPUTED: usize = offset_of!(BindingProperty, computed); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BindingPropertyWithoutKey<'a, 't>( @@ -6344,25 +5574,22 @@ pub struct BindingPropertyWithoutKey<'a, 't>( impl<'a, 't> BindingPropertyWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn value(self) -> &'t BindingPattern<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_VALUE) - as *const BindingPattern<'a>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn shorthand(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_SHORTHAND) as *const bool) } + unsafe { &*from_ref(&(*self.0).shorthand) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -6383,24 +5610,22 @@ pub struct BindingPropertyWithoutValue<'a, 't>( impl<'a, 't> BindingPropertyWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn shorthand(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_SHORTHAND) as *const bool) } + unsafe { &*from_ref(&(*self.0).shorthand) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } } @@ -6411,10 +5636,6 @@ impl<'a, 't> GetAddress for BindingPropertyWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_ARRAY_PATTERN_SPAN: usize = offset_of!(ArrayPattern, span); -pub(crate) const OFFSET_ARRAY_PATTERN_ELEMENTS: usize = offset_of!(ArrayPattern, elements); -pub(crate) const OFFSET_ARRAY_PATTERN_REST: usize = offset_of!(ArrayPattern, rest); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ArrayPatternWithoutElements<'a, 't>( @@ -6425,15 +5646,12 @@ pub struct ArrayPatternWithoutElements<'a, 't>( impl<'a, 't> ArrayPatternWithoutElements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ARRAY_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn rest(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_PATTERN_REST) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).rest) } } } @@ -6454,15 +5672,12 @@ pub struct ArrayPatternWithoutRest<'a, 't>( impl<'a, 't> ArrayPatternWithoutRest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ARRAY_PATTERN_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn elements(self) -> &'t Vec<'a, Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARRAY_PATTERN_ELEMENTS) - as *const Vec<'a, Option>>) - } + unsafe { &*from_ref(&(*self.0).elements) } } } @@ -6473,10 +5688,6 @@ impl<'a, 't> GetAddress for ArrayPatternWithoutRest<'a, 't> { } } -pub(crate) const OFFSET_BINDING_REST_ELEMENT_SPAN: usize = offset_of!(BindingRestElement, span); -pub(crate) const OFFSET_BINDING_REST_ELEMENT_ARGUMENT: usize = - offset_of!(BindingRestElement, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct BindingRestElementWithoutArgument<'a, 't>( @@ -6487,7 +5698,7 @@ pub struct BindingRestElementWithoutArgument<'a, 't>( impl<'a, 't> BindingRestElementWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_BINDING_REST_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -6498,19 +5709,6 @@ impl<'a, 't> GetAddress for BindingRestElementWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_FUNCTION_SPAN: usize = offset_of!(Function, span); -pub(crate) const OFFSET_FUNCTION_TYPE: usize = offset_of!(Function, r#type); -pub(crate) const OFFSET_FUNCTION_ID: usize = offset_of!(Function, id); -pub(crate) const OFFSET_FUNCTION_GENERATOR: usize = offset_of!(Function, generator); -pub(crate) const OFFSET_FUNCTION_ASYNC: usize = offset_of!(Function, r#async); -pub(crate) const OFFSET_FUNCTION_DECLARE: usize = offset_of!(Function, declare); -pub(crate) const OFFSET_FUNCTION_TYPE_PARAMETERS: usize = offset_of!(Function, type_parameters); -pub(crate) const OFFSET_FUNCTION_THIS_PARAM: usize = offset_of!(Function, this_param); -pub(crate) const OFFSET_FUNCTION_PARAMS: usize = offset_of!(Function, params); -pub(crate) const OFFSET_FUNCTION_RETURN_TYPE: usize = offset_of!(Function, return_type); -pub(crate) const OFFSET_FUNCTION_BODY: usize = offset_of!(Function, body); -pub(crate) const OFFSET_FUNCTION_SCOPE_ID: usize = offset_of!(Function, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct FunctionWithoutId<'a, 't>( @@ -6521,74 +5719,57 @@ pub struct FunctionWithoutId<'a, 't>( impl<'a, 't> FunctionWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6609,74 +5790,57 @@ pub struct FunctionWithoutTypeParameters<'a, 't>( impl<'a, 't> FunctionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_ID) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6697,74 +5861,57 @@ pub struct FunctionWithoutThisParam<'a, 't>( impl<'a, 't> FunctionWithoutThisParam<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_ID) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6785,74 +5932,57 @@ pub struct FunctionWithoutParams<'a, 't>( impl<'a, 't> FunctionWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_ID) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6873,74 +6003,57 @@ pub struct FunctionWithoutReturnType<'a, 't>( impl<'a, 't> FunctionWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_ID) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn body(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -6961,74 +6074,57 @@ pub struct FunctionWithoutBody<'a, 't>( impl<'a, 't> FunctionWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t FunctionType { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE) as *const FunctionType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_ID) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn generator(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_GENERATOR) as *const bool) } + unsafe { &*from_ref(&(*self.0).generator) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_ASYNC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7039,11 +6135,6 @@ impl<'a, 't> GetAddress for FunctionWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_FORMAL_PARAMETERS_SPAN: usize = offset_of!(FormalParameters, span); -pub(crate) const OFFSET_FORMAL_PARAMETERS_KIND: usize = offset_of!(FormalParameters, kind); -pub(crate) const OFFSET_FORMAL_PARAMETERS_ITEMS: usize = offset_of!(FormalParameters, items); -pub(crate) const OFFSET_FORMAL_PARAMETERS_REST: usize = offset_of!(FormalParameters, rest); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct FormalParametersWithoutItems<'a, 't>( @@ -7054,23 +6145,17 @@ pub struct FormalParametersWithoutItems<'a, 't>( impl<'a, 't> FormalParametersWithoutItems<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t FormalParameterKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_KIND) - as *const FormalParameterKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn rest(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_REST) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).rest) } } } @@ -7091,23 +6176,17 @@ pub struct FormalParametersWithoutRest<'a, 't>( impl<'a, 't> FormalParametersWithoutRest<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn kind(self) -> &'t FormalParameterKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_KIND) - as *const FormalParameterKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn items(self) -> &'t Vec<'a, FormalParameter<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETERS_ITEMS) - as *const Vec<'a, FormalParameter<'a>>) - } + unsafe { &*from_ref(&(*self.0).items) } } } @@ -7118,15 +6197,6 @@ impl<'a, 't> GetAddress for FormalParametersWithoutRest<'a, 't> { } } -pub(crate) const OFFSET_FORMAL_PARAMETER_SPAN: usize = offset_of!(FormalParameter, span); -pub(crate) const OFFSET_FORMAL_PARAMETER_DECORATORS: usize = - offset_of!(FormalParameter, decorators); -pub(crate) const OFFSET_FORMAL_PARAMETER_PATTERN: usize = offset_of!(FormalParameter, pattern); -pub(crate) const OFFSET_FORMAL_PARAMETER_ACCESSIBILITY: usize = - offset_of!(FormalParameter, accessibility); -pub(crate) const OFFSET_FORMAL_PARAMETER_READONLY: usize = offset_of!(FormalParameter, readonly); -pub(crate) const OFFSET_FORMAL_PARAMETER_OVERRIDE: usize = offset_of!(FormalParameter, r#override); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct FormalParameterWithoutDecorators<'a, 't>( @@ -7137,33 +6207,27 @@ pub struct FormalParameterWithoutDecorators<'a, 't>( impl<'a, 't> FormalParameterWithoutDecorators<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn pattern(self) -> &'t BindingPattern<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_PATTERN) - as *const BindingPattern<'a>) - } + unsafe { &*from_ref(&(*self.0).pattern) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } } @@ -7184,33 +6248,27 @@ pub struct FormalParameterWithoutPattern<'a, 't>( impl<'a, 't> FormalParameterWithoutPattern<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_FORMAL_PARAMETER_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } } @@ -7221,10 +6279,6 @@ impl<'a, 't> GetAddress for FormalParameterWithoutPattern<'a, 't> { } } -pub(crate) const OFFSET_FUNCTION_BODY_SPAN: usize = offset_of!(FunctionBody, span); -pub(crate) const OFFSET_FUNCTION_BODY_DIRECTIVES: usize = offset_of!(FunctionBody, directives); -pub(crate) const OFFSET_FUNCTION_BODY_STATEMENTS: usize = offset_of!(FunctionBody, statements); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct FunctionBodyWithoutDirectives<'a, 't>( @@ -7235,15 +6289,12 @@ pub struct FunctionBodyWithoutDirectives<'a, 't>( impl<'a, 't> FunctionBodyWithoutDirectives<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn statements(self) -> &'t Vec<'a, Statement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY_STATEMENTS) - as *const Vec<'a, Statement<'a>>) - } + unsafe { &*from_ref(&(*self.0).statements) } } } @@ -7264,15 +6315,12 @@ pub struct FunctionBodyWithoutStatements<'a, 't>( impl<'a, 't> FunctionBodyWithoutStatements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn directives(self) -> &'t Vec<'a, Directive<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_FUNCTION_BODY_DIRECTIVES) - as *const Vec<'a, Directive<'a>>) - } + unsafe { &*from_ref(&(*self.0).directives) } } } @@ -7283,23 +6331,6 @@ impl<'a, 't> GetAddress for FunctionBodyWithoutStatements<'a, 't> { } } -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_SPAN: usize = - offset_of!(ArrowFunctionExpression, span); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_EXPRESSION: usize = - offset_of!(ArrowFunctionExpression, expression); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_ASYNC: usize = - offset_of!(ArrowFunctionExpression, r#async); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_TYPE_PARAMETERS: usize = - offset_of!(ArrowFunctionExpression, type_parameters); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_PARAMS: usize = - offset_of!(ArrowFunctionExpression, params); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_RETURN_TYPE: usize = - offset_of!(ArrowFunctionExpression, return_type); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_BODY: usize = - offset_of!(ArrowFunctionExpression, body); -pub(crate) const OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID: usize = - offset_of!(ArrowFunctionExpression, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ArrowFunctionExpressionWithoutTypeParameters<'a, 't>( @@ -7310,56 +6341,37 @@ pub struct ArrowFunctionExpressionWithoutTypeParameters<'a, 't>( impl<'a, 't> ArrowFunctionExpressionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_EXPRESSION) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).expression) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_ASYNC) as *const bool) - } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Box<'a, FunctionBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_BODY) - as *const Box<'a, FunctionBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7380,56 +6392,37 @@ pub struct ArrowFunctionExpressionWithoutParams<'a, 't>( impl<'a, 't> ArrowFunctionExpressionWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_EXPRESSION) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).expression) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_ASYNC) as *const bool) - } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn body(self) -> &'t Box<'a, FunctionBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_BODY) - as *const Box<'a, FunctionBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7450,56 +6443,37 @@ pub struct ArrowFunctionExpressionWithoutReturnType<'a, 't>( impl<'a, 't> ArrowFunctionExpressionWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_EXPRESSION) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).expression) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_ASYNC) as *const bool) - } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn body(self) -> &'t Box<'a, FunctionBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_BODY) - as *const Box<'a, FunctionBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7520,56 +6494,37 @@ pub struct ArrowFunctionExpressionWithoutBody<'a, 't>( impl<'a, 't> ArrowFunctionExpressionWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_EXPRESSION) - as *const bool) - } + unsafe { &*from_ref(&(*self.0).expression) } } #[inline] pub fn r#async(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_ASYNC) as *const bool) - } + unsafe { &*from_ref(&(*self.0).r#async) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7580,10 +6535,6 @@ impl<'a, 't> GetAddress for ArrowFunctionExpressionWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_YIELD_EXPRESSION_SPAN: usize = offset_of!(YieldExpression, span); -pub(crate) const OFFSET_YIELD_EXPRESSION_DELEGATE: usize = offset_of!(YieldExpression, delegate); -pub(crate) const OFFSET_YIELD_EXPRESSION_ARGUMENT: usize = offset_of!(YieldExpression, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct YieldExpressionWithoutArgument<'a, 't>( @@ -7594,12 +6545,12 @@ pub struct YieldExpressionWithoutArgument<'a, 't>( impl<'a, 't> YieldExpressionWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_YIELD_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn delegate(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_YIELD_EXPRESSION_DELEGATE) as *const bool) } + unsafe { &*from_ref(&(*self.0).delegate) } } } @@ -7610,20 +6561,6 @@ impl<'a, 't> GetAddress for YieldExpressionWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_CLASS_SPAN: usize = offset_of!(Class, span); -pub(crate) const OFFSET_CLASS_TYPE: usize = offset_of!(Class, r#type); -pub(crate) const OFFSET_CLASS_DECORATORS: usize = offset_of!(Class, decorators); -pub(crate) const OFFSET_CLASS_ID: usize = offset_of!(Class, id); -pub(crate) const OFFSET_CLASS_TYPE_PARAMETERS: usize = offset_of!(Class, type_parameters); -pub(crate) const OFFSET_CLASS_SUPER_CLASS: usize = offset_of!(Class, super_class); -pub(crate) const OFFSET_CLASS_SUPER_TYPE_PARAMETERS: usize = - offset_of!(Class, super_type_parameters); -pub(crate) const OFFSET_CLASS_IMPLEMENTS: usize = offset_of!(Class, implements); -pub(crate) const OFFSET_CLASS_BODY: usize = offset_of!(Class, body); -pub(crate) const OFFSET_CLASS_ABSTRACT: usize = offset_of!(Class, r#abstract); -pub(crate) const OFFSET_CLASS_DECLARE: usize = offset_of!(Class, declare); -pub(crate) const OFFSET_CLASS_SCOPE_ID: usize = offset_of!(Class, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ClassWithoutDecorators<'a, 't>( @@ -7634,72 +6571,57 @@ pub struct ClassWithoutDecorators<'a, 't>( impl<'a, 't> ClassWithoutDecorators<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7717,72 +6639,57 @@ pub struct ClassWithoutId<'a, 't>(pub(crate) *const Class<'a>, pub(crate) Phanto impl<'a, 't> ClassWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7803,71 +6710,57 @@ pub struct ClassWithoutTypeParameters<'a, 't>( impl<'a, 't> ClassWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7888,72 +6781,57 @@ pub struct ClassWithoutSuperClass<'a, 't>( impl<'a, 't> ClassWithoutSuperClass<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -7974,71 +6852,57 @@ pub struct ClassWithoutSuperTypeParameters<'a, 't>( impl<'a, 't> ClassWithoutSuperTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -8059,71 +6923,57 @@ pub struct ClassWithoutImplements<'a, 't>( impl<'a, 't> ClassWithoutImplements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn body(self) -> &'t Box<'a, ClassBody<'a>> { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY) as *const Box<'a, ClassBody<'a>>) } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -8141,74 +6991,57 @@ pub struct ClassWithoutBody<'a, 't>(pub(crate) *const Class<'a>, pub(crate) Phan impl<'a, 't> ClassWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t ClassType { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE) as *const ClassType) } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_DECORATORS) as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn id(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_ID) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn super_class(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_CLASS) as *const Option>) - } + unsafe { &*from_ref(&(*self.0).super_class) } } #[inline] pub fn super_type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).super_type_parameters) } } #[inline] pub fn implements(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_IMPLEMENTS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).implements) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_CLASS_SCOPE_ID) as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -8219,9 +7052,6 @@ impl<'a, 't> GetAddress for ClassWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_CLASS_BODY_SPAN: usize = offset_of!(ClassBody, span); -pub(crate) const OFFSET_CLASS_BODY_BODY: usize = offset_of!(ClassBody, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ClassBodyWithoutBody<'a, 't>( @@ -8232,7 +7062,7 @@ pub struct ClassBodyWithoutBody<'a, 't>( impl<'a, 't> ClassBodyWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_CLASS_BODY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -8243,21 +7073,6 @@ impl<'a, 't> GetAddress for ClassBodyWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_METHOD_DEFINITION_SPAN: usize = offset_of!(MethodDefinition, span); -pub(crate) const OFFSET_METHOD_DEFINITION_TYPE: usize = offset_of!(MethodDefinition, r#type); -pub(crate) const OFFSET_METHOD_DEFINITION_DECORATORS: usize = - offset_of!(MethodDefinition, decorators); -pub(crate) const OFFSET_METHOD_DEFINITION_KEY: usize = offset_of!(MethodDefinition, key); -pub(crate) const OFFSET_METHOD_DEFINITION_VALUE: usize = offset_of!(MethodDefinition, value); -pub(crate) const OFFSET_METHOD_DEFINITION_KIND: usize = offset_of!(MethodDefinition, kind); -pub(crate) const OFFSET_METHOD_DEFINITION_COMPUTED: usize = offset_of!(MethodDefinition, computed); -pub(crate) const OFFSET_METHOD_DEFINITION_STATIC: usize = offset_of!(MethodDefinition, r#static); -pub(crate) const OFFSET_METHOD_DEFINITION_OVERRIDE: usize = - offset_of!(MethodDefinition, r#override); -pub(crate) const OFFSET_METHOD_DEFINITION_OPTIONAL: usize = offset_of!(MethodDefinition, optional); -pub(crate) const OFFSET_METHOD_DEFINITION_ACCESSIBILITY: usize = - offset_of!(MethodDefinition, accessibility); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct MethodDefinitionWithoutDecorators<'a, 't>( @@ -8268,66 +7083,52 @@ pub struct MethodDefinitionWithoutDecorators<'a, 't>( impl<'a, 't> MethodDefinitionWithoutDecorators<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t MethodDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_TYPE) - as *const MethodDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn value(self) -> &'t Box<'a, Function<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_VALUE) - as *const Box<'a, Function<'a>>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn kind(self) -> &'t MethodDefinitionKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_KIND) - as *const MethodDefinitionKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8348,67 +7149,52 @@ pub struct MethodDefinitionWithoutKey<'a, 't>( impl<'a, 't> MethodDefinitionWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t MethodDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_TYPE) - as *const MethodDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn value(self) -> &'t Box<'a, Function<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_VALUE) - as *const Box<'a, Function<'a>>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn kind(self) -> &'t MethodDefinitionKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_KIND) - as *const MethodDefinitionKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8429,66 +7215,52 @@ pub struct MethodDefinitionWithoutValue<'a, 't>( impl<'a, 't> MethodDefinitionWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t MethodDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_TYPE) - as *const MethodDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn kind(self) -> &'t MethodDefinitionKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_KIND) - as *const MethodDefinitionKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_METHOD_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8499,31 +7271,6 @@ impl<'a, 't> GetAddress for MethodDefinitionWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_PROPERTY_DEFINITION_SPAN: usize = offset_of!(PropertyDefinition, span); -pub(crate) const OFFSET_PROPERTY_DEFINITION_TYPE: usize = offset_of!(PropertyDefinition, r#type); -pub(crate) const OFFSET_PROPERTY_DEFINITION_DECORATORS: usize = - offset_of!(PropertyDefinition, decorators); -pub(crate) const OFFSET_PROPERTY_DEFINITION_KEY: usize = offset_of!(PropertyDefinition, key); -pub(crate) const OFFSET_PROPERTY_DEFINITION_VALUE: usize = offset_of!(PropertyDefinition, value); -pub(crate) const OFFSET_PROPERTY_DEFINITION_COMPUTED: usize = - offset_of!(PropertyDefinition, computed); -pub(crate) const OFFSET_PROPERTY_DEFINITION_STATIC: usize = - offset_of!(PropertyDefinition, r#static); -pub(crate) const OFFSET_PROPERTY_DEFINITION_DECLARE: usize = - offset_of!(PropertyDefinition, declare); -pub(crate) const OFFSET_PROPERTY_DEFINITION_OVERRIDE: usize = - offset_of!(PropertyDefinition, r#override); -pub(crate) const OFFSET_PROPERTY_DEFINITION_OPTIONAL: usize = - offset_of!(PropertyDefinition, optional); -pub(crate) const OFFSET_PROPERTY_DEFINITION_DEFINITE: usize = - offset_of!(PropertyDefinition, definite); -pub(crate) const OFFSET_PROPERTY_DEFINITION_READONLY: usize = - offset_of!(PropertyDefinition, readonly); -pub(crate) const OFFSET_PROPERTY_DEFINITION_TYPE_ANNOTATION: usize = - offset_of!(PropertyDefinition, type_annotation); -pub(crate) const OFFSET_PROPERTY_DEFINITION_ACCESSIBILITY: usize = - offset_of!(PropertyDefinition, accessibility); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct PropertyDefinitionWithoutDecorators<'a, 't>( @@ -8534,81 +7281,67 @@ pub struct PropertyDefinitionWithoutDecorators<'a, 't>( impl<'a, 't> PropertyDefinitionWithoutDecorators<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t PropertyDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE) - as *const PropertyDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8629,82 +7362,67 @@ pub struct PropertyDefinitionWithoutKey<'a, 't>( impl<'a, 't> PropertyDefinitionWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t PropertyDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE) - as *const PropertyDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8725,81 +7443,67 @@ pub struct PropertyDefinitionWithoutValue<'a, 't>( impl<'a, 't> PropertyDefinitionWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t PropertyDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE) - as *const PropertyDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8820,81 +7524,67 @@ pub struct PropertyDefinitionWithoutTypeAnnotation<'a, 't>( impl<'a, 't> PropertyDefinitionWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t PropertyDefinitionType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_TYPE) - as *const PropertyDefinitionType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn r#override(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OVERRIDE) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#override) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_PROPERTY_DEFINITION_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -8905,10 +7595,6 @@ impl<'a, 't> GetAddress for PropertyDefinitionWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_STATIC_BLOCK_SPAN: usize = offset_of!(StaticBlock, span); -pub(crate) const OFFSET_STATIC_BLOCK_BODY: usize = offset_of!(StaticBlock, body); -pub(crate) const OFFSET_STATIC_BLOCK_SCOPE_ID: usize = offset_of!(StaticBlock, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct StaticBlockWithoutBody<'a, 't>( @@ -8919,15 +7605,12 @@ pub struct StaticBlockWithoutBody<'a, 't>( impl<'a, 't> StaticBlockWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_STATIC_BLOCK_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_STATIC_BLOCK_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -8938,20 +7621,6 @@ impl<'a, 't> GetAddress for StaticBlockWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_ACCESSOR_PROPERTY_SPAN: usize = offset_of!(AccessorProperty, span); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_TYPE: usize = offset_of!(AccessorProperty, r#type); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_DECORATORS: usize = - offset_of!(AccessorProperty, decorators); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_KEY: usize = offset_of!(AccessorProperty, key); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_VALUE: usize = offset_of!(AccessorProperty, value); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_COMPUTED: usize = offset_of!(AccessorProperty, computed); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_STATIC: usize = offset_of!(AccessorProperty, r#static); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_DEFINITE: usize = offset_of!(AccessorProperty, definite); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_TYPE_ANNOTATION: usize = - offset_of!(AccessorProperty, type_annotation); -pub(crate) const OFFSET_ACCESSOR_PROPERTY_ACCESSIBILITY: usize = - offset_of!(AccessorProperty, accessibility); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct AccessorPropertyWithoutDecorators<'a, 't>( @@ -8962,61 +7631,47 @@ pub struct AccessorPropertyWithoutDecorators<'a, 't>( impl<'a, 't> AccessorPropertyWithoutDecorators<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t AccessorPropertyType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE) - as *const AccessorPropertyType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -9037,62 +7692,47 @@ pub struct AccessorPropertyWithoutKey<'a, 't>( impl<'a, 't> AccessorPropertyWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t AccessorPropertyType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE) - as *const AccessorPropertyType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -9113,61 +7753,47 @@ pub struct AccessorPropertyWithoutValue<'a, 't>( impl<'a, 't> AccessorPropertyWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t AccessorPropertyType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE) - as *const AccessorPropertyType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -9188,61 +7814,47 @@ pub struct AccessorPropertyWithoutTypeAnnotation<'a, 't>( impl<'a, 't> AccessorPropertyWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#type(self) -> &'t AccessorPropertyType { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_TYPE) - as *const AccessorPropertyType) - } + unsafe { &*from_ref(&(*self.0).r#type) } } #[inline] pub fn decorators(self) -> &'t Vec<'a, Decorator<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DECORATORS) - as *const Vec<'a, Decorator<'a>>) - } + unsafe { &*from_ref(&(*self.0).decorators) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } #[inline] pub fn definite(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_DEFINITE) as *const bool) } + unsafe { &*from_ref(&(*self.0).definite) } } #[inline] pub fn accessibility(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_ACCESSOR_PROPERTY_ACCESSIBILITY) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).accessibility) } } } @@ -9253,12 +7865,6 @@ impl<'a, 't> GetAddress for AccessorPropertyWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_EXPRESSION_SPAN: usize = offset_of!(ImportExpression, span); -pub(crate) const OFFSET_IMPORT_EXPRESSION_SOURCE: usize = offset_of!(ImportExpression, source); -pub(crate) const OFFSET_IMPORT_EXPRESSION_ARGUMENTS: usize = - offset_of!(ImportExpression, arguments); -pub(crate) const OFFSET_IMPORT_EXPRESSION_PHASE: usize = offset_of!(ImportExpression, phase); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportExpressionWithoutSource<'a, 't>( @@ -9269,23 +7875,17 @@ pub struct ImportExpressionWithoutSource<'a, 't>( impl<'a, 't> ImportExpressionWithoutSource<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn arguments(self) -> &'t Vec<'a, Expression<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_ARGUMENTS) - as *const Vec<'a, Expression<'a>>) - } + unsafe { &*from_ref(&(*self.0).arguments) } } #[inline] pub fn phase(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_PHASE) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).phase) } } } @@ -9306,22 +7906,17 @@ pub struct ImportExpressionWithoutArguments<'a, 't>( impl<'a, 't> ImportExpressionWithoutArguments<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_SOURCE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn phase(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_EXPRESSION_PHASE) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).phase) } } } @@ -9332,16 +7927,6 @@ impl<'a, 't> GetAddress for ImportExpressionWithoutArguments<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_DECLARATION_SPAN: usize = offset_of!(ImportDeclaration, span); -pub(crate) const OFFSET_IMPORT_DECLARATION_SPECIFIERS: usize = - offset_of!(ImportDeclaration, specifiers); -pub(crate) const OFFSET_IMPORT_DECLARATION_SOURCE: usize = offset_of!(ImportDeclaration, source); -pub(crate) const OFFSET_IMPORT_DECLARATION_PHASE: usize = offset_of!(ImportDeclaration, phase); -pub(crate) const OFFSET_IMPORT_DECLARATION_WITH_CLAUSE: usize = - offset_of!(ImportDeclaration, with_clause); -pub(crate) const OFFSET_IMPORT_DECLARATION_IMPORT_KIND: usize = - offset_of!(ImportDeclaration, import_kind); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportDeclarationWithoutSpecifiers<'a, 't>( @@ -9352,39 +7937,27 @@ pub struct ImportDeclarationWithoutSpecifiers<'a, 't>( impl<'a, 't> ImportDeclarationWithoutSpecifiers<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source(self) -> &'t StringLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SOURCE) - as *const StringLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn phase(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_PHASE) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).phase) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -9405,39 +7978,27 @@ pub struct ImportDeclarationWithoutSource<'a, 't>( impl<'a, 't> ImportDeclarationWithoutSource<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn specifiers(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SPECIFIERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).specifiers) } } #[inline] pub fn phase(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_PHASE) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).phase) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -9458,39 +8019,27 @@ pub struct ImportDeclarationWithoutWithClause<'a, 't>( impl<'a, 't> ImportDeclarationWithoutWithClause<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn specifiers(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SPECIFIERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).specifiers) } } #[inline] pub fn source(self) -> &'t StringLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_SOURCE) - as *const StringLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn phase(self) -> &'t Option { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_PHASE) - as *const Option) - } + unsafe { &*from_ref(&(*self.0).phase) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DECLARATION_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -9501,12 +8050,6 @@ impl<'a, 't> GetAddress for ImportDeclarationWithoutWithClause<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_SPECIFIER_SPAN: usize = offset_of!(ImportSpecifier, span); -pub(crate) const OFFSET_IMPORT_SPECIFIER_IMPORTED: usize = offset_of!(ImportSpecifier, imported); -pub(crate) const OFFSET_IMPORT_SPECIFIER_LOCAL: usize = offset_of!(ImportSpecifier, local); -pub(crate) const OFFSET_IMPORT_SPECIFIER_IMPORT_KIND: usize = - offset_of!(ImportSpecifier, import_kind); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportSpecifierWithoutImported<'a, 't>( @@ -9517,23 +8060,17 @@ pub struct ImportSpecifierWithoutImported<'a, 't>( impl<'a, 't> ImportSpecifierWithoutImported<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn local(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_LOCAL) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).local) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -9554,23 +8091,17 @@ pub struct ImportSpecifierWithoutLocal<'a, 't>( impl<'a, 't> ImportSpecifierWithoutLocal<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn imported(self) -> &'t ModuleExportName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_IMPORTED) - as *const ModuleExportName<'a>) - } + unsafe { &*from_ref(&(*self.0).imported) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_SPECIFIER_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -9581,11 +8112,6 @@ impl<'a, 't> GetAddress for ImportSpecifierWithoutLocal<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_DEFAULT_SPECIFIER_SPAN: usize = - offset_of!(ImportDefaultSpecifier, span); -pub(crate) const OFFSET_IMPORT_DEFAULT_SPECIFIER_LOCAL: usize = - offset_of!(ImportDefaultSpecifier, local); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportDefaultSpecifierWithoutLocal<'a, 't>( @@ -9596,9 +8122,7 @@ pub struct ImportDefaultSpecifierWithoutLocal<'a, 't>( impl<'a, 't> ImportDefaultSpecifierWithoutLocal<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_DEFAULT_SPECIFIER_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -9609,11 +8133,6 @@ impl<'a, 't> GetAddress for ImportDefaultSpecifierWithoutLocal<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_NAMESPACE_SPECIFIER_SPAN: usize = - offset_of!(ImportNamespaceSpecifier, span); -pub(crate) const OFFSET_IMPORT_NAMESPACE_SPECIFIER_LOCAL: usize = - offset_of!(ImportNamespaceSpecifier, local); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportNamespaceSpecifierWithoutLocal<'a, 't>( @@ -9624,9 +8143,7 @@ pub struct ImportNamespaceSpecifierWithoutLocal<'a, 't>( impl<'a, 't> ImportNamespaceSpecifierWithoutLocal<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_NAMESPACE_SPECIFIER_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -9637,11 +8154,6 @@ impl<'a, 't> GetAddress for ImportNamespaceSpecifierWithoutLocal<'a, 't> { } } -pub(crate) const OFFSET_WITH_CLAUSE_SPAN: usize = offset_of!(WithClause, span); -pub(crate) const OFFSET_WITH_CLAUSE_ATTRIBUTES_KEYWORD: usize = - offset_of!(WithClause, attributes_keyword); -pub(crate) const OFFSET_WITH_CLAUSE_WITH_ENTRIES: usize = offset_of!(WithClause, with_entries); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct WithClauseWithoutAttributesKeyword<'a, 't>( @@ -9652,15 +8164,12 @@ pub struct WithClauseWithoutAttributesKeyword<'a, 't>( impl<'a, 't> WithClauseWithoutAttributesKeyword<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WITH_CLAUSE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn with_entries(self) -> &'t Vec<'a, ImportAttribute<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_WITH_CLAUSE_WITH_ENTRIES) - as *const Vec<'a, ImportAttribute<'a>>) - } + unsafe { &*from_ref(&(*self.0).with_entries) } } } @@ -9681,15 +8190,12 @@ pub struct WithClauseWithoutWithEntries<'a, 't>( impl<'a, 't> WithClauseWithoutWithEntries<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_WITH_CLAUSE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn attributes_keyword(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_WITH_CLAUSE_ATTRIBUTES_KEYWORD) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).attributes_keyword) } } } @@ -9700,10 +8206,6 @@ impl<'a, 't> GetAddress for WithClauseWithoutWithEntries<'a, 't> { } } -pub(crate) const OFFSET_IMPORT_ATTRIBUTE_SPAN: usize = offset_of!(ImportAttribute, span); -pub(crate) const OFFSET_IMPORT_ATTRIBUTE_KEY: usize = offset_of!(ImportAttribute, key); -pub(crate) const OFFSET_IMPORT_ATTRIBUTE_VALUE: usize = offset_of!(ImportAttribute, value); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ImportAttributeWithoutKey<'a, 't>( @@ -9714,14 +8216,12 @@ pub struct ImportAttributeWithoutKey<'a, 't>( impl<'a, 't> ImportAttributeWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn value(self) -> &'t StringLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_ATTRIBUTE_VALUE) as *const StringLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).value) } } } @@ -9742,15 +8242,12 @@ pub struct ImportAttributeWithoutValue<'a, 't>( impl<'a, 't> ImportAttributeWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_IMPORT_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t ImportAttributeKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_IMPORT_ATTRIBUTE_KEY) - as *const ImportAttributeKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } } @@ -9761,19 +8258,6 @@ impl<'a, 't> GetAddress for ImportAttributeWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_SPAN: usize = - offset_of!(ExportNamedDeclaration, span); -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_DECLARATION: usize = - offset_of!(ExportNamedDeclaration, declaration); -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_SPECIFIERS: usize = - offset_of!(ExportNamedDeclaration, specifiers); -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_SOURCE: usize = - offset_of!(ExportNamedDeclaration, source); -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_EXPORT_KIND: usize = - offset_of!(ExportNamedDeclaration, export_kind); -pub(crate) const OFFSET_EXPORT_NAMED_DECLARATION_WITH_CLAUSE: usize = - offset_of!(ExportNamedDeclaration, with_clause); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ExportNamedDeclarationWithoutDeclaration<'a, 't>( @@ -9784,41 +8268,27 @@ pub struct ExportNamedDeclarationWithoutDeclaration<'a, 't>( impl<'a, 't> ExportNamedDeclarationWithoutDeclaration<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn specifiers(self) -> &'t Vec<'a, ExportSpecifier<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPECIFIERS) - as *const Vec<'a, ExportSpecifier<'a>>) - } + unsafe { &*from_ref(&(*self.0).specifiers) } } #[inline] pub fn source(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SOURCE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } } @@ -9839,41 +8309,27 @@ pub struct ExportNamedDeclarationWithoutSpecifiers<'a, 't>( impl<'a, 't> ExportNamedDeclarationWithoutSpecifiers<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn declaration(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_DECLARATION) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).declaration) } } #[inline] pub fn source(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SOURCE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } } @@ -9894,41 +8350,27 @@ pub struct ExportNamedDeclarationWithoutSource<'a, 't>( impl<'a, 't> ExportNamedDeclarationWithoutSource<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn declaration(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_DECLARATION) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).declaration) } } #[inline] pub fn specifiers(self) -> &'t Vec<'a, ExportSpecifier<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPECIFIERS) - as *const Vec<'a, ExportSpecifier<'a>>) - } + unsafe { &*from_ref(&(*self.0).specifiers) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } } @@ -9949,41 +8391,27 @@ pub struct ExportNamedDeclarationWithoutWithClause<'a, 't>( impl<'a, 't> ExportNamedDeclarationWithoutWithClause<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn declaration(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_DECLARATION) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).declaration) } } #[inline] pub fn specifiers(self) -> &'t Vec<'a, ExportSpecifier<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SPECIFIERS) - as *const Vec<'a, ExportSpecifier<'a>>) - } + unsafe { &*from_ref(&(*self.0).specifiers) } } #[inline] pub fn source(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_SOURCE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_NAMED_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -9994,13 +8422,6 @@ impl<'a, 't> GetAddress for ExportNamedDeclarationWithoutWithClause<'a, 't> { } } -pub(crate) const OFFSET_EXPORT_DEFAULT_DECLARATION_SPAN: usize = - offset_of!(ExportDefaultDeclaration, span); -pub(crate) const OFFSET_EXPORT_DEFAULT_DECLARATION_DECLARATION: usize = - offset_of!(ExportDefaultDeclaration, declaration); -pub(crate) const OFFSET_EXPORT_DEFAULT_DECLARATION_EXPORTED: usize = - offset_of!(ExportDefaultDeclaration, exported); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ExportDefaultDeclarationWithoutDeclaration<'a, 't>( @@ -10011,17 +8432,12 @@ pub struct ExportDefaultDeclarationWithoutDeclaration<'a, 't>( impl<'a, 't> ExportDefaultDeclarationWithoutDeclaration<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_DEFAULT_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn exported(self) -> &'t ModuleExportName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_DEFAULT_DECLARATION_EXPORTED) - as *const ModuleExportName<'a>) - } + unsafe { &*from_ref(&(*self.0).exported) } } } @@ -10042,17 +8458,12 @@ pub struct ExportDefaultDeclarationWithoutExported<'a, 't>( impl<'a, 't> ExportDefaultDeclarationWithoutExported<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_DEFAULT_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn declaration(self) -> &'t ExportDefaultDeclarationKind<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_DEFAULT_DECLARATION_DECLARATION) - as *const ExportDefaultDeclarationKind<'a>) - } + unsafe { &*from_ref(&(*self.0).declaration) } } } @@ -10063,16 +8474,6 @@ impl<'a, 't> GetAddress for ExportDefaultDeclarationWithoutExported<'a, 't> { } } -pub(crate) const OFFSET_EXPORT_ALL_DECLARATION_SPAN: usize = offset_of!(ExportAllDeclaration, span); -pub(crate) const OFFSET_EXPORT_ALL_DECLARATION_EXPORTED: usize = - offset_of!(ExportAllDeclaration, exported); -pub(crate) const OFFSET_EXPORT_ALL_DECLARATION_SOURCE: usize = - offset_of!(ExportAllDeclaration, source); -pub(crate) const OFFSET_EXPORT_ALL_DECLARATION_WITH_CLAUSE: usize = - offset_of!(ExportAllDeclaration, with_clause); -pub(crate) const OFFSET_EXPORT_ALL_DECLARATION_EXPORT_KIND: usize = - offset_of!(ExportAllDeclaration, export_kind); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ExportAllDeclarationWithoutExported<'a, 't>( @@ -10083,31 +8484,22 @@ pub struct ExportAllDeclarationWithoutExported<'a, 't>( impl<'a, 't> ExportAllDeclarationWithoutExported<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn source(self) -> &'t StringLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_SOURCE) - as *const StringLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -10128,31 +8520,22 @@ pub struct ExportAllDeclarationWithoutSource<'a, 't>( impl<'a, 't> ExportAllDeclarationWithoutSource<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn exported(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_EXPORTED) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).exported) } } #[inline] pub fn with_clause(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_WITH_CLAUSE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).with_clause) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -10173,31 +8556,22 @@ pub struct ExportAllDeclarationWithoutWithClause<'a, 't>( impl<'a, 't> ExportAllDeclarationWithoutWithClause<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn exported(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_EXPORTED) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).exported) } } #[inline] pub fn source(self) -> &'t StringLiteral<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_SOURCE) - as *const StringLiteral<'a>) - } + unsafe { &*from_ref(&(*self.0).source) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_ALL_DECLARATION_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -10208,12 +8582,6 @@ impl<'a, 't> GetAddress for ExportAllDeclarationWithoutWithClause<'a, 't> { } } -pub(crate) const OFFSET_EXPORT_SPECIFIER_SPAN: usize = offset_of!(ExportSpecifier, span); -pub(crate) const OFFSET_EXPORT_SPECIFIER_LOCAL: usize = offset_of!(ExportSpecifier, local); -pub(crate) const OFFSET_EXPORT_SPECIFIER_EXPORTED: usize = offset_of!(ExportSpecifier, exported); -pub(crate) const OFFSET_EXPORT_SPECIFIER_EXPORT_KIND: usize = - offset_of!(ExportSpecifier, export_kind); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct ExportSpecifierWithoutLocal<'a, 't>( @@ -10224,23 +8592,17 @@ pub struct ExportSpecifierWithoutLocal<'a, 't>( impl<'a, 't> ExportSpecifierWithoutLocal<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn exported(self) -> &'t ModuleExportName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_EXPORTED) - as *const ModuleExportName<'a>) - } + unsafe { &*from_ref(&(*self.0).exported) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -10261,23 +8623,17 @@ pub struct ExportSpecifierWithoutExported<'a, 't>( impl<'a, 't> ExportSpecifierWithoutExported<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn local(self) -> &'t ModuleExportName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_LOCAL) - as *const ModuleExportName<'a>) - } + unsafe { &*from_ref(&(*self.0).local) } } #[inline] pub fn export_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_EXPORT_SPECIFIER_EXPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).export_kind) } } } @@ -10288,13 +8644,6 @@ impl<'a, 't> GetAddress for ExportSpecifierWithoutExported<'a, 't> { } } -pub(crate) const OFFSET_JSX_ELEMENT_SPAN: usize = offset_of!(JSXElement, span); -pub(crate) const OFFSET_JSX_ELEMENT_OPENING_ELEMENT: usize = - offset_of!(JSXElement, opening_element); -pub(crate) const OFFSET_JSX_ELEMENT_CLOSING_ELEMENT: usize = - offset_of!(JSXElement, closing_element); -pub(crate) const OFFSET_JSX_ELEMENT_CHILDREN: usize = offset_of!(JSXElement, children); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXElementWithoutOpeningElement<'a, 't>( @@ -10305,23 +8654,17 @@ pub struct JSXElementWithoutOpeningElement<'a, 't>( impl<'a, 't> JSXElementWithoutOpeningElement<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn closing_element(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_CLOSING_ELEMENT) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).closing_element) } } #[inline] pub fn children(self) -> &'t Vec<'a, JSXChild<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_CHILDREN) - as *const Vec<'a, JSXChild<'a>>) - } + unsafe { &*from_ref(&(*self.0).children) } } } @@ -10342,23 +8685,17 @@ pub struct JSXElementWithoutClosingElement<'a, 't>( impl<'a, 't> JSXElementWithoutClosingElement<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn opening_element(self) -> &'t Box<'a, JSXOpeningElement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_OPENING_ELEMENT) - as *const Box<'a, JSXOpeningElement<'a>>) - } + unsafe { &*from_ref(&(*self.0).opening_element) } } #[inline] pub fn children(self) -> &'t Vec<'a, JSXChild<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_CHILDREN) - as *const Vec<'a, JSXChild<'a>>) - } + unsafe { &*from_ref(&(*self.0).children) } } } @@ -10379,23 +8716,17 @@ pub struct JSXElementWithoutChildren<'a, 't>( impl<'a, 't> JSXElementWithoutChildren<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn opening_element(self) -> &'t Box<'a, JSXOpeningElement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_OPENING_ELEMENT) - as *const Box<'a, JSXOpeningElement<'a>>) - } + unsafe { &*from_ref(&(*self.0).opening_element) } } #[inline] pub fn closing_element(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ELEMENT_CLOSING_ELEMENT) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).closing_element) } } } @@ -10406,15 +8737,6 @@ impl<'a, 't> GetAddress for JSXElementWithoutChildren<'a, 't> { } } -pub(crate) const OFFSET_JSX_OPENING_ELEMENT_SPAN: usize = offset_of!(JSXOpeningElement, span); -pub(crate) const OFFSET_JSX_OPENING_ELEMENT_SELF_CLOSING: usize = - offset_of!(JSXOpeningElement, self_closing); -pub(crate) const OFFSET_JSX_OPENING_ELEMENT_NAME: usize = offset_of!(JSXOpeningElement, name); -pub(crate) const OFFSET_JSX_OPENING_ELEMENT_ATTRIBUTES: usize = - offset_of!(JSXOpeningElement, attributes); -pub(crate) const OFFSET_JSX_OPENING_ELEMENT_TYPE_PARAMETERS: usize = - offset_of!(JSXOpeningElement, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXOpeningElementWithoutName<'a, 't>( @@ -10425,30 +8747,22 @@ pub struct JSXOpeningElementWithoutName<'a, 't>( impl<'a, 't> JSXOpeningElementWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn self_closing(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SELF_CLOSING) as *const bool) - } + unsafe { &*from_ref(&(*self.0).self_closing) } } #[inline] pub fn attributes(self) -> &'t Vec<'a, JSXAttributeItem<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_ATTRIBUTES) - as *const Vec<'a, JSXAttributeItem<'a>>) - } + unsafe { &*from_ref(&(*self.0).attributes) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -10469,30 +8783,22 @@ pub struct JSXOpeningElementWithoutAttributes<'a, 't>( impl<'a, 't> JSXOpeningElementWithoutAttributes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn self_closing(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SELF_CLOSING) as *const bool) - } + unsafe { &*from_ref(&(*self.0).self_closing) } } #[inline] pub fn name(self) -> &'t JSXElementName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_NAME) - as *const JSXElementName<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -10513,30 +8819,22 @@ pub struct JSXOpeningElementWithoutTypeParameters<'a, 't>( impl<'a, 't> JSXOpeningElementWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn self_closing(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_SELF_CLOSING) as *const bool) - } + unsafe { &*from_ref(&(*self.0).self_closing) } } #[inline] pub fn name(self) -> &'t JSXElementName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_NAME) - as *const JSXElementName<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } #[inline] pub fn attributes(self) -> &'t Vec<'a, JSXAttributeItem<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_OPENING_ELEMENT_ATTRIBUTES) - as *const Vec<'a, JSXAttributeItem<'a>>) - } + unsafe { &*from_ref(&(*self.0).attributes) } } } @@ -10547,9 +8845,6 @@ impl<'a, 't> GetAddress for JSXOpeningElementWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_JSX_CLOSING_ELEMENT_SPAN: usize = offset_of!(JSXClosingElement, span); -pub(crate) const OFFSET_JSX_CLOSING_ELEMENT_NAME: usize = offset_of!(JSXClosingElement, name); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXClosingElementWithoutName<'a, 't>( @@ -10560,7 +8855,7 @@ pub struct JSXClosingElementWithoutName<'a, 't>( impl<'a, 't> JSXClosingElementWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_CLOSING_ELEMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -10571,13 +8866,6 @@ impl<'a, 't> GetAddress for JSXClosingElementWithoutName<'a, 't> { } } -pub(crate) const OFFSET_JSX_FRAGMENT_SPAN: usize = offset_of!(JSXFragment, span); -pub(crate) const OFFSET_JSX_FRAGMENT_OPENING_FRAGMENT: usize = - offset_of!(JSXFragment, opening_fragment); -pub(crate) const OFFSET_JSX_FRAGMENT_CLOSING_FRAGMENT: usize = - offset_of!(JSXFragment, closing_fragment); -pub(crate) const OFFSET_JSX_FRAGMENT_CHILDREN: usize = offset_of!(JSXFragment, children); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXFragmentWithoutChildren<'a, 't>( @@ -10588,23 +8876,17 @@ pub struct JSXFragmentWithoutChildren<'a, 't>( impl<'a, 't> JSXFragmentWithoutChildren<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_FRAGMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn opening_fragment(self) -> &'t JSXOpeningFragment { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_FRAGMENT_OPENING_FRAGMENT) - as *const JSXOpeningFragment) - } + unsafe { &*from_ref(&(*self.0).opening_fragment) } } #[inline] pub fn closing_fragment(self) -> &'t JSXClosingFragment { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_FRAGMENT_CLOSING_FRAGMENT) - as *const JSXClosingFragment) - } + unsafe { &*from_ref(&(*self.0).closing_fragment) } } } @@ -10615,12 +8897,6 @@ impl<'a, 't> GetAddress for JSXFragmentWithoutChildren<'a, 't> { } } -pub(crate) const OFFSET_JSX_NAMESPACED_NAME_SPAN: usize = offset_of!(JSXNamespacedName, span); -pub(crate) const OFFSET_JSX_NAMESPACED_NAME_NAMESPACE: usize = - offset_of!(JSXNamespacedName, namespace); -pub(crate) const OFFSET_JSX_NAMESPACED_NAME_PROPERTY: usize = - offset_of!(JSXNamespacedName, property); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXNamespacedNameWithoutNamespace<'a, 't>( @@ -10631,15 +8907,12 @@ pub struct JSXNamespacedNameWithoutNamespace<'a, 't>( impl<'a, 't> JSXNamespacedNameWithoutNamespace<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_NAMESPACED_NAME_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn property(self) -> &'t JSXIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_NAMESPACED_NAME_PROPERTY) - as *const JSXIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).property) } } } @@ -10660,15 +8933,12 @@ pub struct JSXNamespacedNameWithoutProperty<'a, 't>( impl<'a, 't> JSXNamespacedNameWithoutProperty<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_NAMESPACED_NAME_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn namespace(self) -> &'t JSXIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_NAMESPACED_NAME_NAMESPACE) - as *const JSXIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).namespace) } } } @@ -10679,12 +8949,6 @@ impl<'a, 't> GetAddress for JSXNamespacedNameWithoutProperty<'a, 't> { } } -pub(crate) const OFFSET_JSX_MEMBER_EXPRESSION_SPAN: usize = offset_of!(JSXMemberExpression, span); -pub(crate) const OFFSET_JSX_MEMBER_EXPRESSION_OBJECT: usize = - offset_of!(JSXMemberExpression, object); -pub(crate) const OFFSET_JSX_MEMBER_EXPRESSION_PROPERTY: usize = - offset_of!(JSXMemberExpression, property); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXMemberExpressionWithoutObject<'a, 't>( @@ -10695,15 +8959,12 @@ pub struct JSXMemberExpressionWithoutObject<'a, 't>( impl<'a, 't> JSXMemberExpressionWithoutObject<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_MEMBER_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn property(self) -> &'t JSXIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_MEMBER_EXPRESSION_PROPERTY) - as *const JSXIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).property) } } } @@ -10724,15 +8985,12 @@ pub struct JSXMemberExpressionWithoutProperty<'a, 't>( impl<'a, 't> JSXMemberExpressionWithoutProperty<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_MEMBER_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object(self) -> &'t JSXMemberExpressionObject<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_MEMBER_EXPRESSION_OBJECT) - as *const JSXMemberExpressionObject<'a>) - } + unsafe { &*from_ref(&(*self.0).object) } } } @@ -10743,11 +9001,6 @@ impl<'a, 't> GetAddress for JSXMemberExpressionWithoutProperty<'a, 't> { } } -pub(crate) const OFFSET_JSX_EXPRESSION_CONTAINER_SPAN: usize = - offset_of!(JSXExpressionContainer, span); -pub(crate) const OFFSET_JSX_EXPRESSION_CONTAINER_EXPRESSION: usize = - offset_of!(JSXExpressionContainer, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXExpressionContainerWithoutExpression<'a, 't>( @@ -10758,9 +9011,7 @@ pub struct JSXExpressionContainerWithoutExpression<'a, 't>( impl<'a, 't> JSXExpressionContainerWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_EXPRESSION_CONTAINER_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -10771,10 +9022,6 @@ impl<'a, 't> GetAddress for JSXExpressionContainerWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_JSX_ATTRIBUTE_SPAN: usize = offset_of!(JSXAttribute, span); -pub(crate) const OFFSET_JSX_ATTRIBUTE_NAME: usize = offset_of!(JSXAttribute, name); -pub(crate) const OFFSET_JSX_ATTRIBUTE_VALUE: usize = offset_of!(JSXAttribute, value); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXAttributeWithoutName<'a, 't>( @@ -10785,15 +9032,12 @@ pub struct JSXAttributeWithoutName<'a, 't>( impl<'a, 't> JSXAttributeWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn value(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ATTRIBUTE_VALUE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).value) } } } @@ -10814,14 +9058,12 @@ pub struct JSXAttributeWithoutValue<'a, 't>( impl<'a, 't> JSXAttributeWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t JSXAttributeName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JSX_ATTRIBUTE_NAME) as *const JSXAttributeName<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } } @@ -10832,10 +9074,6 @@ impl<'a, 't> GetAddress for JSXAttributeWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_JSX_SPREAD_ATTRIBUTE_SPAN: usize = offset_of!(JSXSpreadAttribute, span); -pub(crate) const OFFSET_JSX_SPREAD_ATTRIBUTE_ARGUMENT: usize = - offset_of!(JSXSpreadAttribute, argument); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXSpreadAttributeWithoutArgument<'a, 't>( @@ -10846,7 +9084,7 @@ pub struct JSXSpreadAttributeWithoutArgument<'a, 't>( impl<'a, 't> JSXSpreadAttributeWithoutArgument<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_SPREAD_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -10857,9 +9095,6 @@ impl<'a, 't> GetAddress for JSXSpreadAttributeWithoutArgument<'a, 't> { } } -pub(crate) const OFFSET_JSX_SPREAD_CHILD_SPAN: usize = offset_of!(JSXSpreadChild, span); -pub(crate) const OFFSET_JSX_SPREAD_CHILD_EXPRESSION: usize = offset_of!(JSXSpreadChild, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSXSpreadChildWithoutExpression<'a, 't>( @@ -10870,7 +9105,7 @@ pub struct JSXSpreadChildWithoutExpression<'a, 't>( impl<'a, 't> JSXSpreadChildWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JSX_SPREAD_CHILD_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -10881,11 +9116,6 @@ impl<'a, 't> GetAddress for JSXSpreadChildWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_TS_THIS_PARAMETER_SPAN: usize = offset_of!(TSThisParameter, span); -pub(crate) const OFFSET_TS_THIS_PARAMETER_THIS_SPAN: usize = offset_of!(TSThisParameter, this_span); -pub(crate) const OFFSET_TS_THIS_PARAMETER_TYPE_ANNOTATION: usize = - offset_of!(TSThisParameter, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSThisParameterWithoutTypeAnnotation<'a, 't>( @@ -10896,12 +9126,12 @@ pub struct TSThisParameterWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSThisParameterWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_THIS_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn this_span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_THIS_PARAMETER_THIS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).this_span) } } } @@ -10912,14 +9142,6 @@ impl<'a, 't> GetAddress for TSThisParameterWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_ENUM_DECLARATION_SPAN: usize = offset_of!(TSEnumDeclaration, span); -pub(crate) const OFFSET_TS_ENUM_DECLARATION_ID: usize = offset_of!(TSEnumDeclaration, id); -pub(crate) const OFFSET_TS_ENUM_DECLARATION_MEMBERS: usize = offset_of!(TSEnumDeclaration, members); -pub(crate) const OFFSET_TS_ENUM_DECLARATION_CONST: usize = offset_of!(TSEnumDeclaration, r#const); -pub(crate) const OFFSET_TS_ENUM_DECLARATION_DECLARE: usize = offset_of!(TSEnumDeclaration, declare); -pub(crate) const OFFSET_TS_ENUM_DECLARATION_SCOPE_ID: usize = - offset_of!(TSEnumDeclaration, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSEnumDeclarationWithoutId<'a, 't>( @@ -10930,33 +9152,27 @@ pub struct TSEnumDeclarationWithoutId<'a, 't>( impl<'a, 't> TSEnumDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn members(self) -> &'t Vec<'a, TSEnumMember<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_MEMBERS) - as *const Vec<'a, TSEnumMember<'a>>) - } + unsafe { &*from_ref(&(*self.0).members) } } #[inline] pub fn r#const(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_CONST) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#const) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -10977,33 +9193,27 @@ pub struct TSEnumDeclarationWithoutMembers<'a, 't>( impl<'a, 't> TSEnumDeclarationWithoutMembers<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn r#const(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_CONST) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#const) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_DECLARE) as *const bool) } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -11014,10 +9224,6 @@ impl<'a, 't> GetAddress for TSEnumDeclarationWithoutMembers<'a, 't> { } } -pub(crate) const OFFSET_TS_ENUM_MEMBER_SPAN: usize = offset_of!(TSEnumMember, span); -pub(crate) const OFFSET_TS_ENUM_MEMBER_ID: usize = offset_of!(TSEnumMember, id); -pub(crate) const OFFSET_TS_ENUM_MEMBER_INITIALIZER: usize = offset_of!(TSEnumMember, initializer); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSEnumMemberWithoutId<'a, 't>( @@ -11028,15 +9234,12 @@ pub struct TSEnumMemberWithoutId<'a, 't>( impl<'a, 't> TSEnumMemberWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_MEMBER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn initializer(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_MEMBER_INITIALIZER) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).initializer) } } } @@ -11057,14 +9260,12 @@ pub struct TSEnumMemberWithoutInitializer<'a, 't>( impl<'a, 't> TSEnumMemberWithoutInitializer<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ENUM_MEMBER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t TSEnumMemberName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_ENUM_MEMBER_ID) as *const TSEnumMemberName<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } } @@ -11075,10 +9276,6 @@ impl<'a, 't> GetAddress for TSEnumMemberWithoutInitializer<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_ANNOTATION_SPAN: usize = offset_of!(TSTypeAnnotation, span); -pub(crate) const OFFSET_TS_TYPE_ANNOTATION_TYPE_ANNOTATION: usize = - offset_of!(TSTypeAnnotation, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeAnnotationWithoutTypeAnnotation<'a, 't>( @@ -11089,7 +9286,7 @@ pub struct TSTypeAnnotationWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSTypeAnnotationWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ANNOTATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11100,9 +9297,6 @@ impl<'a, 't> GetAddress for TSTypeAnnotationWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_LITERAL_TYPE_SPAN: usize = offset_of!(TSLiteralType, span); -pub(crate) const OFFSET_TS_LITERAL_TYPE_LITERAL: usize = offset_of!(TSLiteralType, literal); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSLiteralTypeWithoutLiteral<'a, 't>( @@ -11113,7 +9307,7 @@ pub struct TSLiteralTypeWithoutLiteral<'a, 't>( impl<'a, 't> TSLiteralTypeWithoutLiteral<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_LITERAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11124,18 +9318,6 @@ impl<'a, 't> GetAddress for TSLiteralTypeWithoutLiteral<'a, 't> { } } -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_SPAN: usize = offset_of!(TSConditionalType, span); -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_CHECK_TYPE: usize = - offset_of!(TSConditionalType, check_type); -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_EXTENDS_TYPE: usize = - offset_of!(TSConditionalType, extends_type); -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_TRUE_TYPE: usize = - offset_of!(TSConditionalType, true_type); -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_FALSE_TYPE: usize = - offset_of!(TSConditionalType, false_type); -pub(crate) const OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID: usize = - offset_of!(TSConditionalType, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSConditionalTypeWithoutCheckType<'a, 't>( @@ -11146,38 +9328,27 @@ pub struct TSConditionalTypeWithoutCheckType<'a, 't>( impl<'a, 't> TSConditionalTypeWithoutCheckType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn extends_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_EXTENDS_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).extends_type) } } #[inline] pub fn true_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_TRUE_TYPE) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).true_type) } } #[inline] pub fn false_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_FALSE_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).false_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -11198,38 +9369,27 @@ pub struct TSConditionalTypeWithoutExtendsType<'a, 't>( impl<'a, 't> TSConditionalTypeWithoutExtendsType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn check_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_CHECK_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).check_type) } } #[inline] pub fn true_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_TRUE_TYPE) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).true_type) } } #[inline] pub fn false_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_FALSE_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).false_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -11250,39 +9410,27 @@ pub struct TSConditionalTypeWithoutTrueType<'a, 't>( impl<'a, 't> TSConditionalTypeWithoutTrueType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn check_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_CHECK_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).check_type) } } #[inline] pub fn extends_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_EXTENDS_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).extends_type) } } #[inline] pub fn false_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_FALSE_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).false_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -11303,38 +9451,27 @@ pub struct TSConditionalTypeWithoutFalseType<'a, 't>( impl<'a, 't> TSConditionalTypeWithoutFalseType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn check_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_CHECK_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).check_type) } } #[inline] pub fn extends_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_EXTENDS_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).extends_type) } } #[inline] pub fn true_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_TRUE_TYPE) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).true_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -11345,9 +9482,6 @@ impl<'a, 't> GetAddress for TSConditionalTypeWithoutFalseType<'a, 't> { } } -pub(crate) const OFFSET_TS_UNION_TYPE_SPAN: usize = offset_of!(TSUnionType, span); -pub(crate) const OFFSET_TS_UNION_TYPE_TYPES: usize = offset_of!(TSUnionType, types); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSUnionTypeWithoutTypes<'a, 't>( @@ -11358,7 +9492,7 @@ pub struct TSUnionTypeWithoutTypes<'a, 't>( impl<'a, 't> TSUnionTypeWithoutTypes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_UNION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11369,9 +9503,6 @@ impl<'a, 't> GetAddress for TSUnionTypeWithoutTypes<'a, 't> { } } -pub(crate) const OFFSET_TS_INTERSECTION_TYPE_SPAN: usize = offset_of!(TSIntersectionType, span); -pub(crate) const OFFSET_TS_INTERSECTION_TYPE_TYPES: usize = offset_of!(TSIntersectionType, types); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSIntersectionTypeWithoutTypes<'a, 't>( @@ -11382,7 +9513,7 @@ pub struct TSIntersectionTypeWithoutTypes<'a, 't>( impl<'a, 't> TSIntersectionTypeWithoutTypes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INTERSECTION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11393,10 +9524,6 @@ impl<'a, 't> GetAddress for TSIntersectionTypeWithoutTypes<'a, 't> { } } -pub(crate) const OFFSET_TS_PARENTHESIZED_TYPE_SPAN: usize = offset_of!(TSParenthesizedType, span); -pub(crate) const OFFSET_TS_PARENTHESIZED_TYPE_TYPE_ANNOTATION: usize = - offset_of!(TSParenthesizedType, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSParenthesizedTypeWithoutTypeAnnotation<'a, 't>( @@ -11407,7 +9534,7 @@ pub struct TSParenthesizedTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSParenthesizedTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_PARENTHESIZED_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11418,11 +9545,6 @@ impl<'a, 't> GetAddress for TSParenthesizedTypeWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_OPERATOR_SPAN: usize = offset_of!(TSTypeOperator, span); -pub(crate) const OFFSET_TS_TYPE_OPERATOR_OPERATOR: usize = offset_of!(TSTypeOperator, operator); -pub(crate) const OFFSET_TS_TYPE_OPERATOR_TYPE_ANNOTATION: usize = - offset_of!(TSTypeOperator, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeOperatorWithoutTypeAnnotation<'a, 't>( @@ -11433,15 +9555,12 @@ pub struct TSTypeOperatorWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSTypeOperatorWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_OPERATOR_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn operator(self) -> &'t TSTypeOperatorOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_OPERATOR_OPERATOR) - as *const TSTypeOperatorOperator) - } + unsafe { &*from_ref(&(*self.0).operator) } } } @@ -11452,9 +9571,6 @@ impl<'a, 't> GetAddress for TSTypeOperatorWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_ARRAY_TYPE_SPAN: usize = offset_of!(TSArrayType, span); -pub(crate) const OFFSET_TS_ARRAY_TYPE_ELEMENT_TYPE: usize = offset_of!(TSArrayType, element_type); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSArrayTypeWithoutElementType<'a, 't>( @@ -11465,7 +9581,7 @@ pub struct TSArrayTypeWithoutElementType<'a, 't>( impl<'a, 't> TSArrayTypeWithoutElementType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_ARRAY_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11476,12 +9592,6 @@ impl<'a, 't> GetAddress for TSArrayTypeWithoutElementType<'a, 't> { } } -pub(crate) const OFFSET_TS_INDEXED_ACCESS_TYPE_SPAN: usize = offset_of!(TSIndexedAccessType, span); -pub(crate) const OFFSET_TS_INDEXED_ACCESS_TYPE_OBJECT_TYPE: usize = - offset_of!(TSIndexedAccessType, object_type); -pub(crate) const OFFSET_TS_INDEXED_ACCESS_TYPE_INDEX_TYPE: usize = - offset_of!(TSIndexedAccessType, index_type); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSIndexedAccessTypeWithoutObjectType<'a, 't>( @@ -11492,15 +9602,12 @@ pub struct TSIndexedAccessTypeWithoutObjectType<'a, 't>( impl<'a, 't> TSIndexedAccessTypeWithoutObjectType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEXED_ACCESS_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn index_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INDEXED_ACCESS_TYPE_INDEX_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).index_type) } } } @@ -11521,15 +9628,12 @@ pub struct TSIndexedAccessTypeWithoutIndexType<'a, 't>( impl<'a, 't> TSIndexedAccessTypeWithoutIndexType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEXED_ACCESS_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn object_type(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INDEXED_ACCESS_TYPE_OBJECT_TYPE) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).object_type) } } } @@ -11540,9 +9644,6 @@ impl<'a, 't> GetAddress for TSIndexedAccessTypeWithoutIndexType<'a, 't> { } } -pub(crate) const OFFSET_TS_TUPLE_TYPE_SPAN: usize = offset_of!(TSTupleType, span); -pub(crate) const OFFSET_TS_TUPLE_TYPE_ELEMENT_TYPES: usize = offset_of!(TSTupleType, element_types); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTupleTypeWithoutElementTypes<'a, 't>( @@ -11553,7 +9654,7 @@ pub struct TSTupleTypeWithoutElementTypes<'a, 't>( impl<'a, 't> TSTupleTypeWithoutElementTypes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TUPLE_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11564,13 +9665,6 @@ impl<'a, 't> GetAddress for TSTupleTypeWithoutElementTypes<'a, 't> { } } -pub(crate) const OFFSET_TS_NAMED_TUPLE_MEMBER_SPAN: usize = offset_of!(TSNamedTupleMember, span); -pub(crate) const OFFSET_TS_NAMED_TUPLE_MEMBER_ELEMENT_TYPE: usize = - offset_of!(TSNamedTupleMember, element_type); -pub(crate) const OFFSET_TS_NAMED_TUPLE_MEMBER_LABEL: usize = offset_of!(TSNamedTupleMember, label); -pub(crate) const OFFSET_TS_NAMED_TUPLE_MEMBER_OPTIONAL: usize = - offset_of!(TSNamedTupleMember, optional); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSNamedTupleMemberWithoutElementType<'a, 't>( @@ -11581,22 +9675,17 @@ pub struct TSNamedTupleMemberWithoutElementType<'a, 't>( impl<'a, 't> TSNamedTupleMemberWithoutElementType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn label(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_LABEL) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).label) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -11617,22 +9706,17 @@ pub struct TSNamedTupleMemberWithoutLabel<'a, 't>( impl<'a, 't> TSNamedTupleMemberWithoutLabel<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn element_type(self) -> &'t TSTupleElement<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_ELEMENT_TYPE) - as *const TSTupleElement<'a>) - } + unsafe { &*from_ref(&(*self.0).element_type) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_NAMED_TUPLE_MEMBER_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } } @@ -11643,10 +9727,6 @@ impl<'a, 't> GetAddress for TSNamedTupleMemberWithoutLabel<'a, 't> { } } -pub(crate) const OFFSET_TS_OPTIONAL_TYPE_SPAN: usize = offset_of!(TSOptionalType, span); -pub(crate) const OFFSET_TS_OPTIONAL_TYPE_TYPE_ANNOTATION: usize = - offset_of!(TSOptionalType, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSOptionalTypeWithoutTypeAnnotation<'a, 't>( @@ -11657,7 +9737,7 @@ pub struct TSOptionalTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSOptionalTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_OPTIONAL_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11668,10 +9748,6 @@ impl<'a, 't> GetAddress for TSOptionalTypeWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_REST_TYPE_SPAN: usize = offset_of!(TSRestType, span); -pub(crate) const OFFSET_TS_REST_TYPE_TYPE_ANNOTATION: usize = - offset_of!(TSRestType, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSRestTypeWithoutTypeAnnotation<'a, 't>( @@ -11682,7 +9758,7 @@ pub struct TSRestTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSRestTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_REST_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11693,11 +9769,6 @@ impl<'a, 't> GetAddress for TSRestTypeWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_REFERENCE_SPAN: usize = offset_of!(TSTypeReference, span); -pub(crate) const OFFSET_TS_TYPE_REFERENCE_TYPE_NAME: usize = offset_of!(TSTypeReference, type_name); -pub(crate) const OFFSET_TS_TYPE_REFERENCE_TYPE_PARAMETERS: usize = - offset_of!(TSTypeReference, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeReferenceWithoutTypeName<'a, 't>( @@ -11708,15 +9779,12 @@ pub struct TSTypeReferenceWithoutTypeName<'a, 't>( impl<'a, 't> TSTypeReferenceWithoutTypeName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_REFERENCE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_REFERENCE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -11737,15 +9805,12 @@ pub struct TSTypeReferenceWithoutTypeParameters<'a, 't>( impl<'a, 't> TSTypeReferenceWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_REFERENCE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_name(self) -> &'t TSTypeName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_REFERENCE_TYPE_NAME) - as *const TSTypeName<'a>) - } + unsafe { &*from_ref(&(*self.0).type_name) } } } @@ -11756,10 +9821,6 @@ impl<'a, 't> GetAddress for TSTypeReferenceWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_TS_QUALIFIED_NAME_SPAN: usize = offset_of!(TSQualifiedName, span); -pub(crate) const OFFSET_TS_QUALIFIED_NAME_LEFT: usize = offset_of!(TSQualifiedName, left); -pub(crate) const OFFSET_TS_QUALIFIED_NAME_RIGHT: usize = offset_of!(TSQualifiedName, right); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSQualifiedNameWithoutLeft<'a, 't>( @@ -11770,15 +9831,12 @@ pub struct TSQualifiedNameWithoutLeft<'a, 't>( impl<'a, 't> TSQualifiedNameWithoutLeft<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_QUALIFIED_NAME_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn right(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_QUALIFIED_NAME_RIGHT) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).right) } } } @@ -11799,14 +9857,12 @@ pub struct TSQualifiedNameWithoutRight<'a, 't>( impl<'a, 't> TSQualifiedNameWithoutRight<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_QUALIFIED_NAME_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn left(self) -> &'t TSTypeName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_QUALIFIED_NAME_LEFT) as *const TSTypeName<'a>) - } + unsafe { &*from_ref(&(*self.0).left) } } } @@ -11817,11 +9873,6 @@ impl<'a, 't> GetAddress for TSQualifiedNameWithoutRight<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_PARAMETER_INSTANTIATION_SPAN: usize = - offset_of!(TSTypeParameterInstantiation, span); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_INSTANTIATION_PARAMS: usize = - offset_of!(TSTypeParameterInstantiation, params); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeParameterInstantiationWithoutParams<'a, 't>( @@ -11832,10 +9883,7 @@ pub struct TSTypeParameterInstantiationWithoutParams<'a, 't>( impl<'a, 't> TSTypeParameterInstantiationWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_INSTANTIATION_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -11846,15 +9894,6 @@ impl<'a, 't> GetAddress for TSTypeParameterInstantiationWithoutParams<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_PARAMETER_SPAN: usize = offset_of!(TSTypeParameter, span); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_NAME: usize = offset_of!(TSTypeParameter, name); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_CONSTRAINT: usize = - offset_of!(TSTypeParameter, constraint); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_DEFAULT: usize = offset_of!(TSTypeParameter, default); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_IN: usize = offset_of!(TSTypeParameter, r#in); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_OUT: usize = offset_of!(TSTypeParameter, out); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_CONST: usize = offset_of!(TSTypeParameter, r#const); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeParameterWithoutName<'a, 't>( @@ -11865,38 +9904,32 @@ pub struct TSTypeParameterWithoutName<'a, 't>( impl<'a, 't> TSTypeParameterWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn constraint(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_CONSTRAINT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).constraint) } } #[inline] pub fn default(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_DEFAULT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).default) } } #[inline] pub fn r#in(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_IN) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#in) } } #[inline] pub fn out(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_OUT) as *const bool) } + unsafe { &*from_ref(&(*self.0).out) } } #[inline] pub fn r#const(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_CONST) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#const) } } } @@ -11917,38 +9950,32 @@ pub struct TSTypeParameterWithoutConstraint<'a, 't>( impl<'a, 't> TSTypeParameterWithoutConstraint<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_NAME) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } #[inline] pub fn default(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_DEFAULT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).default) } } #[inline] pub fn r#in(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_IN) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#in) } } #[inline] pub fn out(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_OUT) as *const bool) } + unsafe { &*from_ref(&(*self.0).out) } } #[inline] pub fn r#const(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_CONST) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#const) } } } @@ -11969,38 +9996,32 @@ pub struct TSTypeParameterWithoutDefault<'a, 't>( impl<'a, 't> TSTypeParameterWithoutDefault<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_NAME) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } #[inline] pub fn constraint(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_CONSTRAINT) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).constraint) } } #[inline] pub fn r#in(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_IN) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#in) } } #[inline] pub fn out(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_OUT) as *const bool) } + unsafe { &*from_ref(&(*self.0).out) } } #[inline] pub fn r#const(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_CONST) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#const) } } } @@ -12011,11 +10032,6 @@ impl<'a, 't> GetAddress for TSTypeParameterWithoutDefault<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_PARAMETER_DECLARATION_SPAN: usize = - offset_of!(TSTypeParameterDeclaration, span); -pub(crate) const OFFSET_TS_TYPE_PARAMETER_DECLARATION_PARAMS: usize = - offset_of!(TSTypeParameterDeclaration, params); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeParameterDeclarationWithoutParams<'a, 't>( @@ -12026,9 +10042,7 @@ pub struct TSTypeParameterDeclarationWithoutParams<'a, 't>( impl<'a, 't> TSTypeParameterDeclarationWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PARAMETER_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -12039,19 +10053,6 @@ impl<'a, 't> GetAddress for TSTypeParameterDeclarationWithoutParams<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_SPAN: usize = - offset_of!(TSTypeAliasDeclaration, span); -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_ID: usize = - offset_of!(TSTypeAliasDeclaration, id); -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_PARAMETERS: usize = - offset_of!(TSTypeAliasDeclaration, type_parameters); -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_ANNOTATION: usize = - offset_of!(TSTypeAliasDeclaration, type_annotation); -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_DECLARE: usize = - offset_of!(TSTypeAliasDeclaration, declare); -pub(crate) const OFFSET_TS_TYPE_ALIAS_DECLARATION_SCOPE_ID: usize = - offset_of!(TSTypeAliasDeclaration, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeAliasDeclarationWithoutId<'a, 't>( @@ -12062,40 +10063,27 @@ pub struct TSTypeAliasDeclarationWithoutId<'a, 't>( impl<'a, 't> TSTypeAliasDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn type_annotation(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_ANNOTATION) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12116,40 +10104,27 @@ pub struct TSTypeAliasDeclarationWithoutTypeParameters<'a, 't>( impl<'a, 't> TSTypeAliasDeclarationWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_annotation(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_ANNOTATION) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12170,40 +10145,27 @@ pub struct TSTypeAliasDeclarationWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSTypeAliasDeclarationWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ALIAS_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12214,12 +10176,6 @@ impl<'a, 't> GetAddress for TSTypeAliasDeclarationWithoutTypeAnnotation<'a, 't> } } -pub(crate) const OFFSET_TS_CLASS_IMPLEMENTS_SPAN: usize = offset_of!(TSClassImplements, span); -pub(crate) const OFFSET_TS_CLASS_IMPLEMENTS_EXPRESSION: usize = - offset_of!(TSClassImplements, expression); -pub(crate) const OFFSET_TS_CLASS_IMPLEMENTS_TYPE_PARAMETERS: usize = - offset_of!(TSClassImplements, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSClassImplementsWithoutExpression<'a, 't>( @@ -12230,15 +10186,12 @@ pub struct TSClassImplementsWithoutExpression<'a, 't>( impl<'a, 't> TSClassImplementsWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CLASS_IMPLEMENTS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CLASS_IMPLEMENTS_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -12259,15 +10212,12 @@ pub struct TSClassImplementsWithoutTypeParameters<'a, 't>( impl<'a, 't> TSClassImplementsWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CLASS_IMPLEMENTS_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t TSTypeName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CLASS_IMPLEMENTS_EXPRESSION) - as *const TSTypeName<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -12278,20 +10228,6 @@ impl<'a, 't> GetAddress for TSClassImplementsWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_SPAN: usize = - offset_of!(TSInterfaceDeclaration, span); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_ID: usize = offset_of!(TSInterfaceDeclaration, id); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_EXTENDS: usize = - offset_of!(TSInterfaceDeclaration, extends); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_TYPE_PARAMETERS: usize = - offset_of!(TSInterfaceDeclaration, type_parameters); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_BODY: usize = - offset_of!(TSInterfaceDeclaration, body); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_DECLARE: usize = - offset_of!(TSInterfaceDeclaration, declare); -pub(crate) const OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID: usize = - offset_of!(TSInterfaceDeclaration, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSInterfaceDeclarationWithoutId<'a, 't>( @@ -12302,48 +10238,32 @@ pub struct TSInterfaceDeclarationWithoutId<'a, 't>( impl<'a, 't> TSInterfaceDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn extends(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_EXTENDS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).extends) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn body(self) -> &'t Box<'a, TSInterfaceBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_BODY) - as *const Box<'a, TSInterfaceBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12364,48 +10284,32 @@ pub struct TSInterfaceDeclarationWithoutExtends<'a, 't>( impl<'a, 't> TSInterfaceDeclarationWithoutExtends<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn body(self) -> &'t Box<'a, TSInterfaceBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_BODY) - as *const Box<'a, TSInterfaceBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12426,48 +10330,32 @@ pub struct TSInterfaceDeclarationWithoutTypeParameters<'a, 't>( impl<'a, 't> TSInterfaceDeclarationWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn extends(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_EXTENDS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).extends) } } #[inline] pub fn body(self) -> &'t Box<'a, TSInterfaceBody<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_BODY) - as *const Box<'a, TSInterfaceBody<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12488,48 +10376,32 @@ pub struct TSInterfaceDeclarationWithoutBody<'a, 't>( impl<'a, 't> TSInterfaceDeclarationWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn extends(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_EXTENDS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).extends) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -12540,9 +10412,6 @@ impl<'a, 't> GetAddress for TSInterfaceDeclarationWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_TS_INTERFACE_BODY_SPAN: usize = offset_of!(TSInterfaceBody, span); -pub(crate) const OFFSET_TS_INTERFACE_BODY_BODY: usize = offset_of!(TSInterfaceBody, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSInterfaceBodyWithoutBody<'a, 't>( @@ -12553,7 +10422,7 @@ pub struct TSInterfaceBodyWithoutBody<'a, 't>( impl<'a, 't> TSInterfaceBodyWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_BODY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -12564,17 +10433,6 @@ impl<'a, 't> GetAddress for TSInterfaceBodyWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_SPAN: usize = offset_of!(TSPropertySignature, span); -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_COMPUTED: usize = - offset_of!(TSPropertySignature, computed); -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_OPTIONAL: usize = - offset_of!(TSPropertySignature, optional); -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_READONLY: usize = - offset_of!(TSPropertySignature, readonly); -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_KEY: usize = offset_of!(TSPropertySignature, key); -pub(crate) const OFFSET_TS_PROPERTY_SIGNATURE_TYPE_ANNOTATION: usize = - offset_of!(TSPropertySignature, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSPropertySignatureWithoutKey<'a, 't>( @@ -12585,36 +10443,27 @@ pub struct TSPropertySignatureWithoutKey<'a, 't>( impl<'a, 't> TSPropertySignatureWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_COMPUTED) as *const bool) - } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_READONLY) as *const bool) - } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } } @@ -12635,36 +10484,27 @@ pub struct TSPropertySignatureWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSPropertySignatureWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_COMPUTED) as *const bool) - } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_OPTIONAL) as *const bool) - } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_READONLY) as *const bool) - } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_PROPERTY_SIGNATURE_KEY) - as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } } @@ -12675,14 +10515,6 @@ impl<'a, 't> GetAddress for TSPropertySignatureWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_SPAN: usize = offset_of!(TSIndexSignature, span); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_PARAMETERS: usize = - offset_of!(TSIndexSignature, parameters); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_TYPE_ANNOTATION: usize = - offset_of!(TSIndexSignature, type_annotation); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_READONLY: usize = offset_of!(TSIndexSignature, readonly); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_STATIC: usize = offset_of!(TSIndexSignature, r#static); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSIndexSignatureWithoutParameters<'a, 't>( @@ -12693,25 +10525,22 @@ pub struct TSIndexSignatureWithoutParameters<'a, 't>( impl<'a, 't> TSIndexSignatureWithoutParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_annotation(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_TYPE_ANNOTATION) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } } @@ -12732,25 +10561,22 @@ pub struct TSIndexSignatureWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSIndexSignatureWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn parameters(self) -> &'t Vec<'a, TSIndexSignatureName<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_PARAMETERS) - as *const Vec<'a, TSIndexSignatureName<'a>>) - } + unsafe { &*from_ref(&(*self.0).parameters) } } #[inline] pub fn readonly(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_READONLY) as *const bool) } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn r#static(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_STATIC) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#static) } } } @@ -12761,17 +10587,6 @@ impl<'a, 't> GetAddress for TSIndexSignatureWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_CALL_SIGNATURE_DECLARATION_SPAN: usize = - offset_of!(TSCallSignatureDeclaration, span); -pub(crate) const OFFSET_TS_CALL_SIGNATURE_DECLARATION_TYPE_PARAMETERS: usize = - offset_of!(TSCallSignatureDeclaration, type_parameters); -pub(crate) const OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM: usize = - offset_of!(TSCallSignatureDeclaration, this_param); -pub(crate) const OFFSET_TS_CALL_SIGNATURE_DECLARATION_PARAMS: usize = - offset_of!(TSCallSignatureDeclaration, params); -pub(crate) const OFFSET_TS_CALL_SIGNATURE_DECLARATION_RETURN_TYPE: usize = - offset_of!(TSCallSignatureDeclaration, return_type); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSCallSignatureDeclarationWithoutTypeParameters<'a, 't>( @@ -12782,33 +10597,22 @@ pub struct TSCallSignatureDeclarationWithoutTypeParameters<'a, 't>( impl<'a, 't> TSCallSignatureDeclarationWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn this_param(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -12829,33 +10633,22 @@ pub struct TSCallSignatureDeclarationWithoutThisParam<'a, 't>( impl<'a, 't> TSCallSignatureDeclarationWithoutThisParam<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -12876,33 +10669,22 @@ pub struct TSCallSignatureDeclarationWithoutParams<'a, 't>( impl<'a, 't> TSCallSignatureDeclarationWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -12923,33 +10705,22 @@ pub struct TSCallSignatureDeclarationWithoutReturnType<'a, 't>( impl<'a, 't> TSCallSignatureDeclarationWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CALL_SIGNATURE_DECLARATION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } } @@ -12960,23 +10731,6 @@ impl<'a, 't> GetAddress for TSCallSignatureDeclarationWithoutReturnType<'a, 't> } } -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_SPAN: usize = offset_of!(TSMethodSignature, span); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_KEY: usize = offset_of!(TSMethodSignature, key); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_COMPUTED: usize = - offset_of!(TSMethodSignature, computed); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_OPTIONAL: usize = - offset_of!(TSMethodSignature, optional); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_KIND: usize = offset_of!(TSMethodSignature, kind); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS: usize = - offset_of!(TSMethodSignature, type_parameters); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM: usize = - offset_of!(TSMethodSignature, this_param); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_PARAMS: usize = offset_of!(TSMethodSignature, params); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE: usize = - offset_of!(TSMethodSignature, return_type); -pub(crate) const OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID: usize = - offset_of!(TSMethodSignature, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSMethodSignatureWithoutKey<'a, 't>( @@ -12987,65 +10741,47 @@ pub struct TSMethodSignatureWithoutKey<'a, 't>( impl<'a, 't> TSMethodSignatureWithoutKey<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn kind(self) -> &'t TSMethodSignatureKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KIND) - as *const TSMethodSignatureKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13066,64 +10802,47 @@ pub struct TSMethodSignatureWithoutTypeParameters<'a, 't>( impl<'a, 't> TSMethodSignatureWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn kind(self) -> &'t TSMethodSignatureKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KIND) - as *const TSMethodSignatureKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13144,64 +10863,47 @@ pub struct TSMethodSignatureWithoutThisParam<'a, 't>( impl<'a, 't> TSMethodSignatureWithoutThisParam<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn kind(self) -> &'t TSMethodSignatureKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KIND) - as *const TSMethodSignatureKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13222,64 +10924,47 @@ pub struct TSMethodSignatureWithoutParams<'a, 't>( impl<'a, 't> TSMethodSignatureWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn kind(self) -> &'t TSMethodSignatureKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KIND) - as *const TSMethodSignatureKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13300,64 +10985,47 @@ pub struct TSMethodSignatureWithoutReturnType<'a, 't>( impl<'a, 't> TSMethodSignatureWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn key(self) -> &'t PropertyKey<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KEY) as *const PropertyKey<'a>) - } + unsafe { &*from_ref(&(*self.0).key) } } #[inline] pub fn computed(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_COMPUTED) as *const bool) } + unsafe { &*from_ref(&(*self.0).computed) } } #[inline] pub fn optional(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_OPTIONAL) as *const bool) } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn kind(self) -> &'t TSMethodSignatureKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_KIND) - as *const TSMethodSignatureKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13368,17 +11036,6 @@ impl<'a, 't> GetAddress for TSMethodSignatureWithoutReturnType<'a, 't> { } } -pub(crate) const OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SPAN: usize = - offset_of!(TSConstructSignatureDeclaration, span); -pub(crate) const OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_TYPE_PARAMETERS: usize = - offset_of!(TSConstructSignatureDeclaration, type_parameters); -pub(crate) const OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_PARAMS: usize = - offset_of!(TSConstructSignatureDeclaration, params); -pub(crate) const OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_RETURN_TYPE: usize = - offset_of!(TSConstructSignatureDeclaration, return_type); -pub(crate) const OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SCOPE_ID: usize = - offset_of!(TSConstructSignatureDeclaration, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSConstructSignatureDeclarationWithoutTypeParameters<'a, 't>( @@ -13389,34 +11046,22 @@ pub struct TSConstructSignatureDeclarationWithoutTypeParameters<'a, 't>( impl<'a, 't> TSConstructSignatureDeclarationWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13437,34 +11082,22 @@ pub struct TSConstructSignatureDeclarationWithoutParams<'a, 't>( impl<'a, 't> TSConstructSignatureDeclarationWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn return_type(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_RETURN_TYPE) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13485,34 +11118,22 @@ pub struct TSConstructSignatureDeclarationWithoutReturnType<'a, 't>( impl<'a, 't> TSConstructSignatureDeclarationWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13523,13 +11144,6 @@ impl<'a, 't> GetAddress for TSConstructSignatureDeclarationWithoutReturnType<'a, } } -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_NAME_SPAN: usize = - offset_of!(TSIndexSignatureName, span); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_NAME_NAME: usize = - offset_of!(TSIndexSignatureName, name); -pub(crate) const OFFSET_TS_INDEX_SIGNATURE_NAME_TYPE_ANNOTATION: usize = - offset_of!(TSIndexSignatureName, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSIndexSignatureNameWithoutTypeAnnotation<'a, 't>( @@ -13540,14 +11154,12 @@ pub struct TSIndexSignatureNameWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSIndexSignatureNameWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_NAME_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t Atom<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INDEX_SIGNATURE_NAME_NAME) as *const Atom<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } } @@ -13558,12 +11170,6 @@ impl<'a, 't> GetAddress for TSIndexSignatureNameWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_INTERFACE_HERITAGE_SPAN: usize = offset_of!(TSInterfaceHeritage, span); -pub(crate) const OFFSET_TS_INTERFACE_HERITAGE_EXPRESSION: usize = - offset_of!(TSInterfaceHeritage, expression); -pub(crate) const OFFSET_TS_INTERFACE_HERITAGE_TYPE_PARAMETERS: usize = - offset_of!(TSInterfaceHeritage, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSInterfaceHeritageWithoutExpression<'a, 't>( @@ -13574,15 +11180,12 @@ pub struct TSInterfaceHeritageWithoutExpression<'a, 't>( impl<'a, 't> TSInterfaceHeritageWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_HERITAGE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_HERITAGE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -13603,15 +11206,12 @@ pub struct TSInterfaceHeritageWithoutTypeParameters<'a, 't>( impl<'a, 't> TSInterfaceHeritageWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_HERITAGE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INTERFACE_HERITAGE_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -13622,13 +11222,6 @@ impl<'a, 't> GetAddress for TSInterfaceHeritageWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_PREDICATE_SPAN: usize = offset_of!(TSTypePredicate, span); -pub(crate) const OFFSET_TS_TYPE_PREDICATE_PARAMETER_NAME: usize = - offset_of!(TSTypePredicate, parameter_name); -pub(crate) const OFFSET_TS_TYPE_PREDICATE_ASSERTS: usize = offset_of!(TSTypePredicate, asserts); -pub(crate) const OFFSET_TS_TYPE_PREDICATE_TYPE_ANNOTATION: usize = - offset_of!(TSTypePredicate, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypePredicateWithoutParameterName<'a, 't>( @@ -13639,20 +11232,17 @@ pub struct TSTypePredicateWithoutParameterName<'a, 't>( impl<'a, 't> TSTypePredicateWithoutParameterName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn asserts(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_ASSERTS) as *const bool) } + unsafe { &*from_ref(&(*self.0).asserts) } } #[inline] pub fn type_annotation(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_TYPE_ANNOTATION) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } } @@ -13673,20 +11263,17 @@ pub struct TSTypePredicateWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSTypePredicateWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn parameter_name(self) -> &'t TSTypePredicateName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_PARAMETER_NAME) - as *const TSTypePredicateName<'a>) - } + unsafe { &*from_ref(&(*self.0).parameter_name) } } #[inline] pub fn asserts(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_PREDICATE_ASSERTS) as *const bool) } + unsafe { &*from_ref(&(*self.0).asserts) } } } @@ -13697,15 +11284,6 @@ impl<'a, 't> GetAddress for TSTypePredicateWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_MODULE_DECLARATION_SPAN: usize = offset_of!(TSModuleDeclaration, span); -pub(crate) const OFFSET_TS_MODULE_DECLARATION_ID: usize = offset_of!(TSModuleDeclaration, id); -pub(crate) const OFFSET_TS_MODULE_DECLARATION_BODY: usize = offset_of!(TSModuleDeclaration, body); -pub(crate) const OFFSET_TS_MODULE_DECLARATION_KIND: usize = offset_of!(TSModuleDeclaration, kind); -pub(crate) const OFFSET_TS_MODULE_DECLARATION_DECLARE: usize = - offset_of!(TSModuleDeclaration, declare); -pub(crate) const OFFSET_TS_MODULE_DECLARATION_SCOPE_ID: usize = - offset_of!(TSModuleDeclaration, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSModuleDeclarationWithoutId<'a, 't>( @@ -13716,38 +11294,27 @@ pub struct TSModuleDeclarationWithoutId<'a, 't>( impl<'a, 't> TSModuleDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_BODY) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).body) } } #[inline] pub fn kind(self) -> &'t TSModuleDeclarationKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_KIND) - as *const TSModuleDeclarationKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13768,38 +11335,27 @@ pub struct TSModuleDeclarationWithoutBody<'a, 't>( impl<'a, 't> TSModuleDeclarationWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t TSModuleDeclarationName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_ID) - as *const TSModuleDeclarationName<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn kind(self) -> &'t TSModuleDeclarationKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_KIND) - as *const TSModuleDeclarationKind) - } + unsafe { &*from_ref(&(*self.0).kind) } } #[inline] pub fn declare(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_DECLARE) as *const bool) - } + unsafe { &*from_ref(&(*self.0).declare) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_DECLARATION_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -13810,10 +11366,6 @@ impl<'a, 't> GetAddress for TSModuleDeclarationWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_TS_MODULE_BLOCK_SPAN: usize = offset_of!(TSModuleBlock, span); -pub(crate) const OFFSET_TS_MODULE_BLOCK_DIRECTIVES: usize = offset_of!(TSModuleBlock, directives); -pub(crate) const OFFSET_TS_MODULE_BLOCK_BODY: usize = offset_of!(TSModuleBlock, body); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSModuleBlockWithoutDirectives<'a, 't>( @@ -13824,15 +11376,12 @@ pub struct TSModuleBlockWithoutDirectives<'a, 't>( impl<'a, 't> TSModuleBlockWithoutDirectives<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MODULE_BLOCK_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn body(self) -> &'t Vec<'a, Statement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_BLOCK_BODY) - as *const Vec<'a, Statement<'a>>) - } + unsafe { &*from_ref(&(*self.0).body) } } } @@ -13853,15 +11402,12 @@ pub struct TSModuleBlockWithoutBody<'a, 't>( impl<'a, 't> TSModuleBlockWithoutBody<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MODULE_BLOCK_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn directives(self) -> &'t Vec<'a, Directive<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MODULE_BLOCK_DIRECTIVES) - as *const Vec<'a, Directive<'a>>) - } + unsafe { &*from_ref(&(*self.0).directives) } } } @@ -13872,9 +11418,6 @@ impl<'a, 't> GetAddress for TSModuleBlockWithoutBody<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_LITERAL_SPAN: usize = offset_of!(TSTypeLiteral, span); -pub(crate) const OFFSET_TS_TYPE_LITERAL_MEMBERS: usize = offset_of!(TSTypeLiteral, members); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeLiteralWithoutMembers<'a, 't>( @@ -13885,7 +11428,7 @@ pub struct TSTypeLiteralWithoutMembers<'a, 't>( impl<'a, 't> TSTypeLiteralWithoutMembers<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_LITERAL_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -13896,10 +11439,6 @@ impl<'a, 't> GetAddress for TSTypeLiteralWithoutMembers<'a, 't> { } } -pub(crate) const OFFSET_TS_INFER_TYPE_SPAN: usize = offset_of!(TSInferType, span); -pub(crate) const OFFSET_TS_INFER_TYPE_TYPE_PARAMETER: usize = - offset_of!(TSInferType, type_parameter); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSInferTypeWithoutTypeParameter<'a, 't>( @@ -13910,7 +11449,7 @@ pub struct TSInferTypeWithoutTypeParameter<'a, 't>( impl<'a, 't> TSInferTypeWithoutTypeParameter<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_INFER_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -13921,11 +11460,6 @@ impl<'a, 't> GetAddress for TSInferTypeWithoutTypeParameter<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_QUERY_SPAN: usize = offset_of!(TSTypeQuery, span); -pub(crate) const OFFSET_TS_TYPE_QUERY_EXPR_NAME: usize = offset_of!(TSTypeQuery, expr_name); -pub(crate) const OFFSET_TS_TYPE_QUERY_TYPE_PARAMETERS: usize = - offset_of!(TSTypeQuery, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeQueryWithoutExprName<'a, 't>( @@ -13936,15 +11470,12 @@ pub struct TSTypeQueryWithoutExprName<'a, 't>( impl<'a, 't> TSTypeQueryWithoutExprName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_QUERY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_QUERY_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -13965,15 +11496,12 @@ pub struct TSTypeQueryWithoutTypeParameters<'a, 't>( impl<'a, 't> TSTypeQueryWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_QUERY_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expr_name(self) -> &'t TSTypeQueryExprName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_QUERY_EXPR_NAME) - as *const TSTypeQueryExprName<'a>) - } + unsafe { &*from_ref(&(*self.0).expr_name) } } } @@ -13984,14 +11512,6 @@ impl<'a, 't> GetAddress for TSTypeQueryWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_TS_IMPORT_TYPE_SPAN: usize = offset_of!(TSImportType, span); -pub(crate) const OFFSET_TS_IMPORT_TYPE_IS_TYPE_OF: usize = offset_of!(TSImportType, is_type_of); -pub(crate) const OFFSET_TS_IMPORT_TYPE_PARAMETER: usize = offset_of!(TSImportType, parameter); -pub(crate) const OFFSET_TS_IMPORT_TYPE_QUALIFIER: usize = offset_of!(TSImportType, qualifier); -pub(crate) const OFFSET_TS_IMPORT_TYPE_ATTRIBUTES: usize = offset_of!(TSImportType, attributes); -pub(crate) const OFFSET_TS_IMPORT_TYPE_TYPE_PARAMETERS: usize = - offset_of!(TSImportType, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSImportTypeWithoutParameter<'a, 't>( @@ -14002,36 +11522,27 @@ pub struct TSImportTypeWithoutParameter<'a, 't>( impl<'a, 't> TSImportTypeWithoutParameter<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn is_type_of(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_IS_TYPE_OF) as *const bool) } + unsafe { &*from_ref(&(*self.0).is_type_of) } } #[inline] pub fn qualifier(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).qualifier) } } #[inline] pub fn attributes(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_ATTRIBUTES) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).attributes) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -14052,35 +11563,27 @@ pub struct TSImportTypeWithoutQualifier<'a, 't>( impl<'a, 't> TSImportTypeWithoutQualifier<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn is_type_of(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_IS_TYPE_OF) as *const bool) } + unsafe { &*from_ref(&(*self.0).is_type_of) } } #[inline] pub fn parameter(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_PARAMETER) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).parameter) } } #[inline] pub fn attributes(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_ATTRIBUTES) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).attributes) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -14101,35 +11604,27 @@ pub struct TSImportTypeWithoutAttributes<'a, 't>( impl<'a, 't> TSImportTypeWithoutAttributes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn is_type_of(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_IS_TYPE_OF) as *const bool) } + unsafe { &*from_ref(&(*self.0).is_type_of) } } #[inline] pub fn parameter(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_PARAMETER) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).parameter) } } #[inline] pub fn qualifier(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).qualifier) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -14150,35 +11645,27 @@ pub struct TSImportTypeWithoutTypeParameters<'a, 't>( impl<'a, 't> TSImportTypeWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn is_type_of(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_IS_TYPE_OF) as *const bool) } + unsafe { &*from_ref(&(*self.0).is_type_of) } } #[inline] pub fn parameter(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_PARAMETER) as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).parameter) } } #[inline] pub fn qualifier(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).qualifier) } } #[inline] pub fn attributes(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_TYPE_ATTRIBUTES) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).attributes) } } } @@ -14189,12 +11676,6 @@ impl<'a, 't> GetAddress for TSImportTypeWithoutTypeParameters<'a, 't> { } } -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTES_SPAN: usize = offset_of!(TSImportAttributes, span); -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTES_ATTRIBUTES_KEYWORD: usize = - offset_of!(TSImportAttributes, attributes_keyword); -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTES_ELEMENTS: usize = - offset_of!(TSImportAttributes, elements); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSImportAttributesWithoutAttributesKeyword<'a, 't>( @@ -14205,15 +11686,12 @@ pub struct TSImportAttributesWithoutAttributesKeyword<'a, 't>( impl<'a, 't> TSImportAttributesWithoutAttributesKeyword<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTES_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn elements(self) -> &'t Vec<'a, TSImportAttribute<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTES_ELEMENTS) - as *const Vec<'a, TSImportAttribute<'a>>) - } + unsafe { &*from_ref(&(*self.0).elements) } } } @@ -14234,15 +11712,12 @@ pub struct TSImportAttributesWithoutElements<'a, 't>( impl<'a, 't> TSImportAttributesWithoutElements<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTES_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn attributes_keyword(self) -> &'t IdentifierName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTES_ATTRIBUTES_KEYWORD) - as *const IdentifierName<'a>) - } + unsafe { &*from_ref(&(*self.0).attributes_keyword) } } } @@ -14253,10 +11728,6 @@ impl<'a, 't> GetAddress for TSImportAttributesWithoutElements<'a, 't> { } } -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTE_SPAN: usize = offset_of!(TSImportAttribute, span); -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTE_NAME: usize = offset_of!(TSImportAttribute, name); -pub(crate) const OFFSET_TS_IMPORT_ATTRIBUTE_VALUE: usize = offset_of!(TSImportAttribute, value); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSImportAttributeWithoutName<'a, 't>( @@ -14267,14 +11738,12 @@ pub struct TSImportAttributeWithoutName<'a, 't>( impl<'a, 't> TSImportAttributeWithoutName<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn value(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTE_VALUE) as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).value) } } } @@ -14295,15 +11764,12 @@ pub struct TSImportAttributeWithoutValue<'a, 't>( impl<'a, 't> TSImportAttributeWithoutValue<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name(self) -> &'t TSImportAttributeName<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_ATTRIBUTE_NAME) - as *const TSImportAttributeName<'a>) - } + unsafe { &*from_ref(&(*self.0).name) } } } @@ -14314,14 +11780,6 @@ impl<'a, 't> GetAddress for TSImportAttributeWithoutValue<'a, 't> { } } -pub(crate) const OFFSET_TS_FUNCTION_TYPE_SPAN: usize = offset_of!(TSFunctionType, span); -pub(crate) const OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS: usize = - offset_of!(TSFunctionType, type_parameters); -pub(crate) const OFFSET_TS_FUNCTION_TYPE_THIS_PARAM: usize = offset_of!(TSFunctionType, this_param); -pub(crate) const OFFSET_TS_FUNCTION_TYPE_PARAMS: usize = offset_of!(TSFunctionType, params); -pub(crate) const OFFSET_TS_FUNCTION_TYPE_RETURN_TYPE: usize = - offset_of!(TSFunctionType, return_type); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSFunctionTypeWithoutTypeParameters<'a, 't>( @@ -14332,31 +11790,22 @@ pub struct TSFunctionTypeWithoutTypeParameters<'a, 't>( impl<'a, 't> TSFunctionTypeWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_RETURN_TYPE) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -14377,31 +11826,22 @@ pub struct TSFunctionTypeWithoutThisParam<'a, 't>( impl<'a, 't> TSFunctionTypeWithoutThisParam<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_RETURN_TYPE) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -14422,31 +11862,22 @@ pub struct TSFunctionTypeWithoutParams<'a, 't>( impl<'a, 't> TSFunctionTypeWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn return_type(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_RETURN_TYPE) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -14467,31 +11898,22 @@ pub struct TSFunctionTypeWithoutReturnType<'a, 't>( impl<'a, 't> TSFunctionTypeWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn this_param(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_THIS_PARAM) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).this_param) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_FUNCTION_TYPE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } } @@ -14502,15 +11924,6 @@ impl<'a, 't> GetAddress for TSFunctionTypeWithoutReturnType<'a, 't> { } } -pub(crate) const OFFSET_TS_CONSTRUCTOR_TYPE_SPAN: usize = offset_of!(TSConstructorType, span); -pub(crate) const OFFSET_TS_CONSTRUCTOR_TYPE_ABSTRACT: usize = - offset_of!(TSConstructorType, r#abstract); -pub(crate) const OFFSET_TS_CONSTRUCTOR_TYPE_TYPE_PARAMETERS: usize = - offset_of!(TSConstructorType, type_parameters); -pub(crate) const OFFSET_TS_CONSTRUCTOR_TYPE_PARAMS: usize = offset_of!(TSConstructorType, params); -pub(crate) const OFFSET_TS_CONSTRUCTOR_TYPE_RETURN_TYPE: usize = - offset_of!(TSConstructorType, return_type); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSConstructorTypeWithoutTypeParameters<'a, 't>( @@ -14521,28 +11934,22 @@ pub struct TSConstructorTypeWithoutTypeParameters<'a, 't>( impl<'a, 't> TSConstructorTypeWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } #[inline] pub fn return_type(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_RETURN_TYPE) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -14563,28 +11970,22 @@ pub struct TSConstructorTypeWithoutParams<'a, 't>( impl<'a, 't> TSConstructorTypeWithoutParams<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn return_type(self) -> &'t Box<'a, TSTypeAnnotation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_RETURN_TYPE) - as *const Box<'a, TSTypeAnnotation<'a>>) - } + unsafe { &*from_ref(&(*self.0).return_type) } } } @@ -14605,28 +12006,22 @@ pub struct TSConstructorTypeWithoutReturnType<'a, 't>( impl<'a, 't> TSConstructorTypeWithoutReturnType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn r#abstract(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_ABSTRACT) as *const bool) } + unsafe { &*from_ref(&(*self.0).r#abstract) } } #[inline] pub fn type_parameters(self) -> &'t Option>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_TYPE_PARAMETERS) - as *const Option>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } #[inline] pub fn params(self) -> &'t Box<'a, FormalParameters<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_CONSTRUCTOR_TYPE_PARAMS) - as *const Box<'a, FormalParameters<'a>>) - } + unsafe { &*from_ref(&(*self.0).params) } } } @@ -14637,16 +12032,6 @@ impl<'a, 't> GetAddress for TSConstructorTypeWithoutReturnType<'a, 't> { } } -pub(crate) const OFFSET_TS_MAPPED_TYPE_SPAN: usize = offset_of!(TSMappedType, span); -pub(crate) const OFFSET_TS_MAPPED_TYPE_TYPE_PARAMETER: usize = - offset_of!(TSMappedType, type_parameter); -pub(crate) const OFFSET_TS_MAPPED_TYPE_NAME_TYPE: usize = offset_of!(TSMappedType, name_type); -pub(crate) const OFFSET_TS_MAPPED_TYPE_TYPE_ANNOTATION: usize = - offset_of!(TSMappedType, type_annotation); -pub(crate) const OFFSET_TS_MAPPED_TYPE_OPTIONAL: usize = offset_of!(TSMappedType, optional); -pub(crate) const OFFSET_TS_MAPPED_TYPE_READONLY: usize = offset_of!(TSMappedType, readonly); -pub(crate) const OFFSET_TS_MAPPED_TYPE_SCOPE_ID: usize = offset_of!(TSMappedType, scope_id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSMappedTypeWithoutTypeParameter<'a, 't>( @@ -14657,47 +12042,32 @@ pub struct TSMappedTypeWithoutTypeParameter<'a, 't>( impl<'a, 't> TSMappedTypeWithoutTypeParameter<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn name_type(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_NAME_TYPE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).name_type) } } #[inline] pub fn type_annotation(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_TYPE_ANNOTATION) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn optional(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_OPTIONAL) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn readonly(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_READONLY) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -14718,47 +12088,32 @@ pub struct TSMappedTypeWithoutNameType<'a, 't>( impl<'a, 't> TSMappedTypeWithoutNameType<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameter(self) -> &'t Box<'a, TSTypeParameter<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_TYPE_PARAMETER) - as *const Box<'a, TSTypeParameter<'a>>) - } + unsafe { &*from_ref(&(*self.0).type_parameter) } } #[inline] pub fn type_annotation(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_TYPE_ANNOTATION) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } #[inline] pub fn optional(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_OPTIONAL) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn readonly(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_READONLY) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -14779,47 +12134,32 @@ pub struct TSMappedTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSMappedTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameter(self) -> &'t Box<'a, TSTypeParameter<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_TYPE_PARAMETER) - as *const Box<'a, TSTypeParameter<'a>>) - } + unsafe { &*from_ref(&(*self.0).type_parameter) } } #[inline] pub fn name_type(self) -> &'t Option> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_NAME_TYPE) - as *const Option>) - } + unsafe { &*from_ref(&(*self.0).name_type) } } #[inline] pub fn optional(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_OPTIONAL) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).optional) } } #[inline] pub fn readonly(self) -> &'t TSMappedTypeModifierOperator { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_READONLY) - as *const TSMappedTypeModifierOperator) - } + unsafe { &*from_ref(&(*self.0).readonly) } } #[inline] pub fn scope_id(self) -> &'t Cell> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_MAPPED_TYPE_SCOPE_ID) - as *const Cell>) - } + unsafe { &*from_ref(&(*self.0).scope_id) } } } @@ -14830,13 +12170,6 @@ impl<'a, 't> GetAddress for TSMappedTypeWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_TEMPLATE_LITERAL_TYPE_SPAN: usize = - offset_of!(TSTemplateLiteralType, span); -pub(crate) const OFFSET_TS_TEMPLATE_LITERAL_TYPE_QUASIS: usize = - offset_of!(TSTemplateLiteralType, quasis); -pub(crate) const OFFSET_TS_TEMPLATE_LITERAL_TYPE_TYPES: usize = - offset_of!(TSTemplateLiteralType, types); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTemplateLiteralTypeWithoutQuasis<'a, 't>( @@ -14847,17 +12180,12 @@ pub struct TSTemplateLiteralTypeWithoutQuasis<'a, 't>( impl<'a, 't> TSTemplateLiteralTypeWithoutQuasis<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TEMPLATE_LITERAL_TYPE_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn types(self) -> &'t Vec<'a, TSType<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TEMPLATE_LITERAL_TYPE_TYPES) - as *const Vec<'a, TSType<'a>>) - } + unsafe { &*from_ref(&(*self.0).types) } } } @@ -14878,17 +12206,12 @@ pub struct TSTemplateLiteralTypeWithoutTypes<'a, 't>( impl<'a, 't> TSTemplateLiteralTypeWithoutTypes<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TEMPLATE_LITERAL_TYPE_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn quasis(self) -> &'t Vec<'a, TemplateElement<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TEMPLATE_LITERAL_TYPE_QUASIS) - as *const Vec<'a, TemplateElement<'a>>) - } + unsafe { &*from_ref(&(*self.0).quasis) } } } @@ -14899,11 +12222,6 @@ impl<'a, 't> GetAddress for TSTemplateLiteralTypeWithoutTypes<'a, 't> { } } -pub(crate) const OFFSET_TS_AS_EXPRESSION_SPAN: usize = offset_of!(TSAsExpression, span); -pub(crate) const OFFSET_TS_AS_EXPRESSION_EXPRESSION: usize = offset_of!(TSAsExpression, expression); -pub(crate) const OFFSET_TS_AS_EXPRESSION_TYPE_ANNOTATION: usize = - offset_of!(TSAsExpression, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSAsExpressionWithoutExpression<'a, 't>( @@ -14914,15 +12232,12 @@ pub struct TSAsExpressionWithoutExpression<'a, 't>( impl<'a, 't> TSAsExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_AS_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_annotation(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_AS_EXPRESSION_TYPE_ANNOTATION) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } } @@ -14943,15 +12258,12 @@ pub struct TSAsExpressionWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSAsExpressionWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_AS_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_AS_EXPRESSION_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -14962,13 +12274,6 @@ impl<'a, 't> GetAddress for TSAsExpressionWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_SATISFIES_EXPRESSION_SPAN: usize = - offset_of!(TSSatisfiesExpression, span); -pub(crate) const OFFSET_TS_SATISFIES_EXPRESSION_EXPRESSION: usize = - offset_of!(TSSatisfiesExpression, expression); -pub(crate) const OFFSET_TS_SATISFIES_EXPRESSION_TYPE_ANNOTATION: usize = - offset_of!(TSSatisfiesExpression, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSSatisfiesExpressionWithoutExpression<'a, 't>( @@ -14979,15 +12284,12 @@ pub struct TSSatisfiesExpressionWithoutExpression<'a, 't>( impl<'a, 't> TSSatisfiesExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_SATISFIES_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_annotation(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_SATISFIES_EXPRESSION_TYPE_ANNOTATION) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } } @@ -15008,15 +12310,12 @@ pub struct TSSatisfiesExpressionWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSSatisfiesExpressionWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_SATISFIES_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_SATISFIES_EXPRESSION_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -15027,12 +12326,6 @@ impl<'a, 't> GetAddress for TSSatisfiesExpressionWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_TYPE_ASSERTION_SPAN: usize = offset_of!(TSTypeAssertion, span); -pub(crate) const OFFSET_TS_TYPE_ASSERTION_EXPRESSION: usize = - offset_of!(TSTypeAssertion, expression); -pub(crate) const OFFSET_TS_TYPE_ASSERTION_TYPE_ANNOTATION: usize = - offset_of!(TSTypeAssertion, type_annotation); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSTypeAssertionWithoutExpression<'a, 't>( @@ -15043,15 +12336,12 @@ pub struct TSTypeAssertionWithoutExpression<'a, 't>( impl<'a, 't> TSTypeAssertionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ASSERTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_annotation(self) -> &'t TSType<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ASSERTION_TYPE_ANNOTATION) - as *const TSType<'a>) - } + unsafe { &*from_ref(&(*self.0).type_annotation) } } } @@ -15072,15 +12362,12 @@ pub struct TSTypeAssertionWithoutTypeAnnotation<'a, 't>( impl<'a, 't> TSTypeAssertionWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ASSERTION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_TYPE_ASSERTION_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -15091,15 +12378,6 @@ impl<'a, 't> GetAddress for TSTypeAssertionWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_TS_IMPORT_EQUALS_DECLARATION_SPAN: usize = - offset_of!(TSImportEqualsDeclaration, span); -pub(crate) const OFFSET_TS_IMPORT_EQUALS_DECLARATION_ID: usize = - offset_of!(TSImportEqualsDeclaration, id); -pub(crate) const OFFSET_TS_IMPORT_EQUALS_DECLARATION_MODULE_REFERENCE: usize = - offset_of!(TSImportEqualsDeclaration, module_reference); -pub(crate) const OFFSET_TS_IMPORT_EQUALS_DECLARATION_IMPORT_KIND: usize = - offset_of!(TSImportEqualsDeclaration, import_kind); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSImportEqualsDeclarationWithoutId<'a, 't>( @@ -15110,25 +12388,17 @@ pub struct TSImportEqualsDeclarationWithoutId<'a, 't>( impl<'a, 't> TSImportEqualsDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn module_reference(self) -> &'t TSModuleReference<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_MODULE_REFERENCE) - as *const TSModuleReference<'a>) - } + unsafe { &*from_ref(&(*self.0).module_reference) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -15149,25 +12419,17 @@ pub struct TSImportEqualsDeclarationWithoutModuleReference<'a, 't>( impl<'a, 't> TSImportEqualsDeclarationWithoutModuleReference<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn id(self) -> &'t BindingIdentifier<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_ID) - as *const BindingIdentifier<'a>) - } + unsafe { &*from_ref(&(*self.0).id) } } #[inline] pub fn import_kind(self) -> &'t ImportOrExportKind { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_IMPORT_EQUALS_DECLARATION_IMPORT_KIND) - as *const ImportOrExportKind) - } + unsafe { &*from_ref(&(*self.0).import_kind) } } } @@ -15178,11 +12440,6 @@ impl<'a, 't> GetAddress for TSImportEqualsDeclarationWithoutModuleReference<'a, } } -pub(crate) const OFFSET_TS_EXTERNAL_MODULE_REFERENCE_SPAN: usize = - offset_of!(TSExternalModuleReference, span); -pub(crate) const OFFSET_TS_EXTERNAL_MODULE_REFERENCE_EXPRESSION: usize = - offset_of!(TSExternalModuleReference, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSExternalModuleReferenceWithoutExpression<'a, 't>( @@ -15193,9 +12450,7 @@ pub struct TSExternalModuleReferenceWithoutExpression<'a, 't>( impl<'a, 't> TSExternalModuleReferenceWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_EXTERNAL_MODULE_REFERENCE_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -15206,10 +12461,6 @@ impl<'a, 't> GetAddress for TSExternalModuleReferenceWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_TS_NON_NULL_EXPRESSION_SPAN: usize = offset_of!(TSNonNullExpression, span); -pub(crate) const OFFSET_TS_NON_NULL_EXPRESSION_EXPRESSION: usize = - offset_of!(TSNonNullExpression, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSNonNullExpressionWithoutExpression<'a, 't>( @@ -15220,7 +12471,7 @@ pub struct TSNonNullExpressionWithoutExpression<'a, 't>( impl<'a, 't> TSNonNullExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_NON_NULL_EXPRESSION_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -15231,9 +12482,6 @@ impl<'a, 't> GetAddress for TSNonNullExpressionWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_DECORATOR_SPAN: usize = offset_of!(Decorator, span); -pub(crate) const OFFSET_DECORATOR_EXPRESSION: usize = offset_of!(Decorator, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct DecoratorWithoutExpression<'a, 't>( @@ -15244,7 +12492,7 @@ pub struct DecoratorWithoutExpression<'a, 't>( impl<'a, 't> DecoratorWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_DECORATOR_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -15255,10 +12503,6 @@ impl<'a, 't> GetAddress for DecoratorWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_TS_EXPORT_ASSIGNMENT_SPAN: usize = offset_of!(TSExportAssignment, span); -pub(crate) const OFFSET_TS_EXPORT_ASSIGNMENT_EXPRESSION: usize = - offset_of!(TSExportAssignment, expression); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSExportAssignmentWithoutExpression<'a, 't>( @@ -15269,7 +12513,7 @@ pub struct TSExportAssignmentWithoutExpression<'a, 't>( impl<'a, 't> TSExportAssignmentWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_TS_EXPORT_ASSIGNMENT_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -15280,11 +12524,6 @@ impl<'a, 't> GetAddress for TSExportAssignmentWithoutExpression<'a, 't> { } } -pub(crate) const OFFSET_TS_NAMESPACE_EXPORT_DECLARATION_SPAN: usize = - offset_of!(TSNamespaceExportDeclaration, span); -pub(crate) const OFFSET_TS_NAMESPACE_EXPORT_DECLARATION_ID: usize = - offset_of!(TSNamespaceExportDeclaration, id); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSNamespaceExportDeclarationWithoutId<'a, 't>( @@ -15295,10 +12534,7 @@ pub struct TSNamespaceExportDeclarationWithoutId<'a, 't>( impl<'a, 't> TSNamespaceExportDeclarationWithoutId<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_NAMESPACE_EXPORT_DECLARATION_SPAN) - as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } } @@ -15309,13 +12545,6 @@ impl<'a, 't> GetAddress for TSNamespaceExportDeclarationWithoutId<'a, 't> { } } -pub(crate) const OFFSET_TS_INSTANTIATION_EXPRESSION_SPAN: usize = - offset_of!(TSInstantiationExpression, span); -pub(crate) const OFFSET_TS_INSTANTIATION_EXPRESSION_EXPRESSION: usize = - offset_of!(TSInstantiationExpression, expression); -pub(crate) const OFFSET_TS_INSTANTIATION_EXPRESSION_TYPE_PARAMETERS: usize = - offset_of!(TSInstantiationExpression, type_parameters); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct TSInstantiationExpressionWithoutExpression<'a, 't>( @@ -15326,17 +12555,12 @@ pub struct TSInstantiationExpressionWithoutExpression<'a, 't>( impl<'a, 't> TSInstantiationExpressionWithoutExpression<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INSTANTIATION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn type_parameters(self) -> &'t Box<'a, TSTypeParameterInstantiation<'a>> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INSTANTIATION_EXPRESSION_TYPE_PARAMETERS) - as *const Box<'a, TSTypeParameterInstantiation<'a>>) - } + unsafe { &*from_ref(&(*self.0).type_parameters) } } } @@ -15357,17 +12581,12 @@ pub struct TSInstantiationExpressionWithoutTypeParameters<'a, 't>( impl<'a, 't> TSInstantiationExpressionWithoutTypeParameters<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INSTANTIATION_EXPRESSION_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn expression(self) -> &'t Expression<'a> { - unsafe { - &*((self.0 as *const u8).add(OFFSET_TS_INSTANTIATION_EXPRESSION_EXPRESSION) - as *const Expression<'a>) - } + unsafe { &*from_ref(&(*self.0).expression) } } } @@ -15378,12 +12597,6 @@ impl<'a, 't> GetAddress for TSInstantiationExpressionWithoutTypeParameters<'a, ' } } -pub(crate) const OFFSET_JS_DOC_NULLABLE_TYPE_SPAN: usize = offset_of!(JSDocNullableType, span); -pub(crate) const OFFSET_JS_DOC_NULLABLE_TYPE_TYPE_ANNOTATION: usize = - offset_of!(JSDocNullableType, type_annotation); -pub(crate) const OFFSET_JS_DOC_NULLABLE_TYPE_POSTFIX: usize = - offset_of!(JSDocNullableType, postfix); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSDocNullableTypeWithoutTypeAnnotation<'a, 't>( @@ -15394,12 +12607,12 @@ pub struct JSDocNullableTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> JSDocNullableTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { &*((self.0 as *const u8).add(OFFSET_JS_DOC_NULLABLE_TYPE_SPAN) as *const Span) } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn postfix(self) -> &'t bool { - unsafe { &*((self.0 as *const u8).add(OFFSET_JS_DOC_NULLABLE_TYPE_POSTFIX) as *const bool) } + unsafe { &*from_ref(&(*self.0).postfix) } } } @@ -15410,13 +12623,6 @@ impl<'a, 't> GetAddress for JSDocNullableTypeWithoutTypeAnnotation<'a, 't> { } } -pub(crate) const OFFSET_JS_DOC_NON_NULLABLE_TYPE_SPAN: usize = - offset_of!(JSDocNonNullableType, span); -pub(crate) const OFFSET_JS_DOC_NON_NULLABLE_TYPE_TYPE_ANNOTATION: usize = - offset_of!(JSDocNonNullableType, type_annotation); -pub(crate) const OFFSET_JS_DOC_NON_NULLABLE_TYPE_POSTFIX: usize = - offset_of!(JSDocNonNullableType, postfix); - #[repr(transparent)] #[derive(Clone, Copy, Debug)] pub struct JSDocNonNullableTypeWithoutTypeAnnotation<'a, 't>( @@ -15427,16 +12633,12 @@ pub struct JSDocNonNullableTypeWithoutTypeAnnotation<'a, 't>( impl<'a, 't> JSDocNonNullableTypeWithoutTypeAnnotation<'a, 't> { #[inline] pub fn span(self) -> &'t Span { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JS_DOC_NON_NULLABLE_TYPE_SPAN) as *const Span) - } + unsafe { &*from_ref(&(*self.0).span) } } #[inline] pub fn postfix(self) -> &'t bool { - unsafe { - &*((self.0 as *const u8).add(OFFSET_JS_DOC_NON_NULLABLE_TYPE_POSTFIX) as *const bool) - } + unsafe { &*from_ref(&(*self.0).postfix) } } } diff --git a/crates/oxc_traverse/src/generated/walk.rs b/crates/oxc_traverse/src/generated/walk.rs index ac11cc94acea0..cdee788c9ab9d 100644 --- a/crates/oxc_traverse/src/generated/walk.rs +++ b/crates/oxc_traverse/src/generated/walk.rs @@ -2,18 +2,12 @@ // Generated by `oxc_traverse/scripts/build.mjs`. // To alter this generated file you have to edit the codegen. -#![expect( - clippy::semicolon_if_nothing_returned, - clippy::ptr_as_ptr, - clippy::ref_as_ptr, - clippy::cast_ptr_alignment -)] +#![expect(clippy::semicolon_if_nothing_returned, clippy::ptr_as_ptr, clippy::ref_as_ptr)] -use std::{cell::Cell, marker::PhantomData}; +use std::{marker::PhantomData, ptr::from_mut}; use oxc_allocator::Vec; use oxc_ast::ast::*; -use oxc_syntax::scope::ScopeId; use crate::{ ancestor::{self, AncestorType}, @@ -42,10 +36,7 @@ unsafe fn walk_program<'a, Tr: Traverse<'a>>( ) { traverser.enter_program(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_PROGRAM_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_hoist_scope_id = ctx.current_hoist_scope_id(); ctx.set_current_hoist_scope_id(current_scope_id); @@ -53,23 +44,15 @@ unsafe fn walk_program<'a, Tr: Traverse<'a>>( ctx.set_current_block_scope_id(current_scope_id); let pop_token = ctx .push_stack(Ancestor::ProgramHashbang(ancestor::ProgramWithoutHashbang(node, PhantomData))); - if let Some(field) = - &mut *((node as *mut u8).add(ancestor::OFFSET_PROGRAM_HASHBANG) as *mut Option) - { + if let Some(field) = &mut (*node).hashbang { walk_hashbang(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::ProgramDirectives); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_PROGRAM_DIRECTIVES) as *mut Vec) - { + for item in &mut (*node).directives { walk_directive(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::ProgramBody); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PROGRAM_BODY) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); ctx.set_current_hoist_scope_id(previous_hoist_scope_id); @@ -254,9 +237,7 @@ unsafe fn walk_array_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ArrayExpressionElements( ancestor::ArrayExpressionWithoutElements(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_ARRAY_EXPRESSION_ELEMENTS) - as *mut Vec) - { + for item in &mut (*node).elements { walk_array_expression_element(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -340,9 +321,7 @@ unsafe fn walk_object_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ObjectExpressionProperties( ancestor::ObjectExpressionWithoutProperties(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_OBJECT_EXPRESSION_PROPERTIES) - as *mut Vec) - { + for item in &mut (*node).properties { walk_object_property_kind(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -375,17 +354,9 @@ unsafe fn walk_object_property<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ObjectPropertyKey( ancestor::ObjectPropertyWithoutKey(node, PhantomData), )); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_OBJECT_PROPERTY_KEY) as *mut PropertyKey, - ctx, - ); + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); ctx.retag_stack(AncestorType::ObjectPropertyValue); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_OBJECT_PROPERTY_VALUE) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).value), ctx); ctx.pop_stack(pop_token); traverser.exit_object_property(&mut *node, ctx); } @@ -458,15 +429,11 @@ unsafe fn walk_template_literal<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TemplateLiteralQuasis( ancestor::TemplateLiteralWithoutQuasis(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TEMPLATE_LITERAL_QUASIS) - as *mut Vec) - { + for item in &mut (*node).quasis { walk_template_element(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::TemplateLiteralExpressions); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TEMPLATE_LITERAL_EXPRESSIONS) - as *mut Vec) - { + for item in &mut (*node).expressions { walk_expression(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -482,22 +449,10 @@ unsafe fn walk_tagged_template_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TaggedTemplateExpressionTag( ancestor::TaggedTemplateExpressionWithoutTag(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TAGGED_TEMPLATE_EXPRESSION_TAG) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).tag), ctx); ctx.retag_stack(AncestorType::TaggedTemplateExpressionQuasi); - walk_template_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TAGGED_TEMPLATE_EXPRESSION_QUASI) - as *mut TemplateLiteral, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TAGGED_TEMPLATE_EXPRESSION_TYPE_PARAMETERS) - as *mut Option>) - { + walk_template_literal(traverser, from_mut(&mut (*node).quasi), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TaggedTemplateExpressionTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -543,19 +498,9 @@ unsafe fn walk_computed_member_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ComputedMemberExpressionObject( ancestor::ComputedMemberExpressionWithoutObject(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_COMPUTED_MEMBER_EXPRESSION_OBJECT) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).object), ctx); ctx.retag_stack(AncestorType::ComputedMemberExpressionExpression); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_COMPUTED_MEMBER_EXPRESSION_EXPRESSION) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_computed_member_expression(&mut *node, ctx); } @@ -569,18 +514,9 @@ unsafe fn walk_static_member_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::StaticMemberExpressionObject( ancestor::StaticMemberExpressionWithoutObject(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_STATIC_MEMBER_EXPRESSION_OBJECT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).object), ctx); ctx.retag_stack(AncestorType::StaticMemberExpressionProperty); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_STATIC_MEMBER_EXPRESSION_PROPERTY) - as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).property), ctx); ctx.pop_stack(pop_token); traverser.exit_static_member_expression(&mut *node, ctx); } @@ -594,18 +530,9 @@ unsafe fn walk_private_field_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::PrivateFieldExpressionObject( ancestor::PrivateFieldExpressionWithoutObject(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PRIVATE_FIELD_EXPRESSION_OBJECT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).object), ctx); ctx.retag_stack(AncestorType::PrivateFieldExpressionField); - walk_private_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PRIVATE_FIELD_EXPRESSION_FIELD) - as *mut PrivateIdentifier, - ctx, - ); + walk_private_identifier(traverser, from_mut(&mut (*node).field), ctx); ctx.pop_stack(pop_token); traverser.exit_private_field_expression(&mut *node, ctx); } @@ -619,22 +546,13 @@ unsafe fn walk_call_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::CallExpressionCallee( ancestor::CallExpressionWithoutCallee(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CALL_EXPRESSION_CALLEE) as *mut Expression, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_CALL_EXPRESSION_TYPE_PARAMETERS) - as *mut Option>) - { + walk_expression(traverser, from_mut(&mut (*node).callee), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::CallExpressionTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::CallExpressionArguments); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_CALL_EXPRESSION_ARGUMENTS) - as *mut Vec) - { + for item in &mut (*node).arguments { walk_argument(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -650,21 +568,12 @@ unsafe fn walk_new_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::NewExpressionCallee( ancestor::NewExpressionWithoutCallee(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_NEW_EXPRESSION_CALLEE) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).callee), ctx); ctx.retag_stack(AncestorType::NewExpressionArguments); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_NEW_EXPRESSION_ARGUMENTS) - as *mut Vec) - { + for item in &mut (*node).arguments { walk_argument(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_NEW_EXPRESSION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::NewExpressionTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -682,17 +591,9 @@ unsafe fn walk_meta_property<'a, Tr: Traverse<'a>>( node, PhantomData, ))); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_META_PROPERTY_META) as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).meta), ctx); ctx.retag_stack(AncestorType::MetaPropertyProperty); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_META_PROPERTY_PROPERTY) as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).property), ctx); ctx.pop_stack(pop_token); traverser.exit_meta_property(&mut *node, ctx); } @@ -706,11 +607,7 @@ unsafe fn walk_spread_element<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::SpreadElementArgument( ancestor::SpreadElementWithoutArgument(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_SPREAD_ELEMENT_ARGUMENT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_spread_element(&mut *node, ctx); } @@ -780,12 +677,7 @@ unsafe fn walk_update_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::UpdateExpressionArgument( ancestor::UpdateExpressionWithoutArgument(node, PhantomData), )); - walk_simple_assignment_target( - traverser, - (node as *mut u8).add(ancestor::OFFSET_UPDATE_EXPRESSION_ARGUMENT) - as *mut SimpleAssignmentTarget, - ctx, - ); + walk_simple_assignment_target(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_update_expression(&mut *node, ctx); } @@ -799,11 +691,7 @@ unsafe fn walk_unary_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::UnaryExpressionArgument( ancestor::UnaryExpressionWithoutArgument(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_UNARY_EXPRESSION_ARGUMENT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_unary_expression(&mut *node, ctx); } @@ -817,17 +705,9 @@ unsafe fn walk_binary_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::BinaryExpressionLeft( ancestor::BinaryExpressionWithoutLeft(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINARY_EXPRESSION_LEFT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::BinaryExpressionRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINARY_EXPRESSION_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_binary_expression(&mut *node, ctx); } @@ -841,18 +721,9 @@ unsafe fn walk_private_in_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::PrivateInExpressionLeft( ancestor::PrivateInExpressionWithoutLeft(node, PhantomData), )); - walk_private_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PRIVATE_IN_EXPRESSION_LEFT) - as *mut PrivateIdentifier, - ctx, - ); + walk_private_identifier(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::PrivateInExpressionRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PRIVATE_IN_EXPRESSION_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_private_in_expression(&mut *node, ctx); } @@ -866,17 +737,9 @@ unsafe fn walk_logical_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::LogicalExpressionLeft( ancestor::LogicalExpressionWithoutLeft(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_LOGICAL_EXPRESSION_LEFT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::LogicalExpressionRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_LOGICAL_EXPRESSION_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_logical_expression(&mut *node, ctx); } @@ -890,24 +753,11 @@ unsafe fn walk_conditional_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ConditionalExpressionTest( ancestor::ConditionalExpressionWithoutTest(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CONDITIONAL_EXPRESSION_TEST) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).test), ctx); ctx.retag_stack(AncestorType::ConditionalExpressionConsequent); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CONDITIONAL_EXPRESSION_CONSEQUENT) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).consequent), ctx); ctx.retag_stack(AncestorType::ConditionalExpressionAlternate); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CONDITIONAL_EXPRESSION_ALTERNATE) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).alternate), ctx); ctx.pop_stack(pop_token); traverser.exit_conditional_expression(&mut *node, ctx); } @@ -921,17 +771,9 @@ unsafe fn walk_assignment_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentExpressionLeft( ancestor::AssignmentExpressionWithoutLeft(node, PhantomData), )); - walk_assignment_target( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_EXPRESSION_LEFT) as *mut AssignmentTarget, - ctx, - ); + walk_assignment_target(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::AssignmentExpressionRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_EXPRESSION_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_assignment_expression(&mut *node, ctx); } @@ -1022,16 +864,10 @@ unsafe fn walk_array_assignment_target<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ArrayAssignmentTargetElements( ancestor::ArrayAssignmentTargetWithoutElements(node, PhantomData), )); - for item in (*((node as *mut u8).add(ancestor::OFFSET_ARRAY_ASSIGNMENT_TARGET_ELEMENTS) - as *mut Vec>)) - .iter_mut() - .flatten() - { + for item in (*node).elements.iter_mut().flatten() { walk_assignment_target_maybe_default(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_ARRAY_ASSIGNMENT_TARGET_REST) - as *mut Option) - { + if let Some(field) = &mut (*node).rest { ctx.retag_stack(AncestorType::ArrayAssignmentTargetRest); walk_assignment_target_rest(traverser, field as *mut _, ctx); } @@ -1048,15 +884,10 @@ unsafe fn walk_object_assignment_target<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ObjectAssignmentTargetProperties( ancestor::ObjectAssignmentTargetWithoutProperties(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_OBJECT_ASSIGNMENT_TARGET_PROPERTIES) - as *mut Vec) - { + for item in &mut (*node).properties { walk_assignment_target_property(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_OBJECT_ASSIGNMENT_TARGET_REST) - as *mut Option) - { + if let Some(field) = &mut (*node).rest { ctx.retag_stack(AncestorType::ObjectAssignmentTargetRest); walk_assignment_target_rest(traverser, field as *mut _, ctx); } @@ -1073,12 +904,7 @@ unsafe fn walk_assignment_target_rest<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentTargetRestTarget( ancestor::AssignmentTargetRestWithoutTarget(node, PhantomData), )); - walk_assignment_target( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_REST_TARGET) - as *mut AssignmentTarget, - ctx, - ); + walk_assignment_target(traverser, from_mut(&mut (*node).target), ctx); ctx.pop_stack(pop_token); traverser.exit_assignment_target_rest(&mut *node, ctx); } @@ -1119,19 +945,9 @@ unsafe fn walk_assignment_target_with_default<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentTargetWithDefaultBinding( ancestor::AssignmentTargetWithDefaultWithoutBinding(node, PhantomData), )); - walk_assignment_target( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_BINDING) - as *mut AssignmentTarget, - ctx, - ); + walk_assignment_target(traverser, from_mut(&mut (*node).binding), ctx); ctx.retag_stack(AncestorType::AssignmentTargetWithDefaultInit); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_WITH_DEFAULT_INIT) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).init), ctx); ctx.pop_stack(pop_token); traverser.exit_assignment_target_with_default(&mut *node, ctx); } @@ -1162,16 +978,8 @@ unsafe fn walk_assignment_target_property_identifier<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentTargetPropertyIdentifierBinding( ancestor::AssignmentTargetPropertyIdentifierWithoutBinding(node, PhantomData), )); - walk_identifier_reference( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_BINDING) - as *mut IdentifierReference, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_ASSIGNMENT_TARGET_PROPERTY_IDENTIFIER_INIT) - as *mut Option) - { + walk_identifier_reference(traverser, from_mut(&mut (*node).binding), ctx); + if let Some(field) = &mut (*node).init { ctx.retag_stack(AncestorType::AssignmentTargetPropertyIdentifierInit); walk_expression(traverser, field as *mut _, ctx); } @@ -1188,19 +996,9 @@ unsafe fn walk_assignment_target_property_property<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentTargetPropertyPropertyName( ancestor::AssignmentTargetPropertyPropertyWithoutName(node, PhantomData), )); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_NAME) - as *mut PropertyKey, - ctx, - ); + walk_property_key(traverser, from_mut(&mut (*node).name), ctx); ctx.retag_stack(AncestorType::AssignmentTargetPropertyPropertyBinding); - walk_assignment_target_maybe_default( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_TARGET_PROPERTY_PROPERTY_BINDING) - as *mut AssignmentTargetMaybeDefault, - ctx, - ); + walk_assignment_target_maybe_default(traverser, from_mut(&mut (*node).binding), ctx); ctx.pop_stack(pop_token); traverser.exit_assignment_target_property_property(&mut *node, ctx); } @@ -1214,9 +1012,7 @@ unsafe fn walk_sequence_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::SequenceExpressionExpressions( ancestor::SequenceExpressionWithoutExpressions(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_SEQUENCE_EXPRESSION_EXPRESSIONS) - as *mut Vec) - { + for item in &mut (*node).expressions { walk_expression(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1241,11 +1037,7 @@ unsafe fn walk_await_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AwaitExpressionArgument( ancestor::AwaitExpressionWithoutArgument(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_AWAIT_EXPRESSION_ARGUMENT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_await_expression(&mut *node, ctx); } @@ -1259,11 +1051,7 @@ unsafe fn walk_chain_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ChainExpressionExpression( ancestor::ChainExpressionWithoutExpression(node, PhantomData), )); - walk_chain_element( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CHAIN_EXPRESSION_EXPRESSION) as *mut ChainElement, - ctx, - ); + walk_chain_element(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_chain_expression(&mut *node, ctx); } @@ -1299,12 +1087,7 @@ unsafe fn walk_parenthesized_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ParenthesizedExpressionExpression( ancestor::ParenthesizedExpressionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PARENTHESIZED_EXPRESSION_EXPRESSION) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_parenthesized_expression(&mut *node, ctx); } @@ -1399,11 +1182,7 @@ unsafe fn walk_directive<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::DirectiveExpression( ancestor::DirectiveWithoutExpression(node, PhantomData), )); - walk_string_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_DIRECTIVE_EXPRESSION) as *mut StringLiteral, - ctx, - ); + walk_string_literal(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_directive(&mut *node, ctx); } @@ -1424,21 +1203,14 @@ unsafe fn walk_block_statement<'a, Tr: Traverse<'a>>( ) { traverser.enter_block_statement(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_BLOCK_STATEMENT_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_block_scope_id = ctx.current_block_scope_id(); ctx.set_current_block_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::BlockStatementBody( ancestor::BlockStatementWithoutBody(node, PhantomData), )); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BLOCK_STATEMENT_BODY) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); ctx.set_current_block_scope_id(previous_block_scope_id); @@ -1487,9 +1259,7 @@ unsafe fn walk_variable_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::VariableDeclarationDeclarations( ancestor::VariableDeclarationWithoutDeclarations(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_VARIABLE_DECLARATION_DECLARATIONS) - as *mut Vec) - { + for item in &mut (*node).declarations { walk_variable_declarator(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1505,14 +1275,8 @@ unsafe fn walk_variable_declarator<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::VariableDeclaratorId( ancestor::VariableDeclaratorWithoutId(node, PhantomData), )); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_VARIABLE_DECLARATOR_ID) as *mut BindingPattern, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_VARIABLE_DECLARATOR_INIT) - as *mut Option) - { + walk_binding_pattern(traverser, from_mut(&mut (*node).id), ctx); + if let Some(field) = &mut (*node).init { ctx.retag_stack(AncestorType::VariableDeclaratorInit); walk_expression(traverser, field as *mut _, ctx); } @@ -1538,11 +1302,7 @@ unsafe fn walk_expression_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ExpressionStatementExpression( ancestor::ExpressionStatementWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPRESSION_STATEMENT_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_expression_statement(&mut *node, ctx); } @@ -1555,20 +1315,10 @@ unsafe fn walk_if_statement<'a, Tr: Traverse<'a>>( traverser.enter_if_statement(&mut *node, ctx); let pop_token = ctx .push_stack(Ancestor::IfStatementTest(ancestor::IfStatementWithoutTest(node, PhantomData))); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IF_STATEMENT_TEST) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).test), ctx); ctx.retag_stack(AncestorType::IfStatementConsequent); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IF_STATEMENT_CONSEQUENT) as *mut Statement, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_IF_STATEMENT_ALTERNATE) - as *mut Option) - { + walk_statement(traverser, from_mut(&mut (*node).consequent), ctx); + if let Some(field) = &mut (*node).alternate { ctx.retag_stack(AncestorType::IfStatementAlternate); walk_statement(traverser, field as *mut _, ctx); } @@ -1585,17 +1335,9 @@ unsafe fn walk_do_while_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::DoWhileStatementBody( ancestor::DoWhileStatementWithoutBody(node, PhantomData), )); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_DO_WHILE_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.retag_stack(AncestorType::DoWhileStatementTest); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_DO_WHILE_STATEMENT_TEST) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).test), ctx); ctx.pop_stack(pop_token); traverser.exit_do_while_statement(&mut *node, ctx); } @@ -1609,17 +1351,9 @@ unsafe fn walk_while_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::WhileStatementTest( ancestor::WhileStatementWithoutTest(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_WHILE_STATEMENT_TEST) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).test), ctx); ctx.retag_stack(AncestorType::WhileStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_WHILE_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); traverser.exit_while_statement(&mut *node, ctx); } @@ -1631,38 +1365,25 @@ unsafe fn walk_for_statement<'a, Tr: Traverse<'a>>( ) { traverser.enter_for_statement(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_FOR_STATEMENT_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::ForStatementInit(ancestor::ForStatementWithoutInit( node, PhantomData, ))); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FOR_STATEMENT_INIT) - as *mut Option) - { + if let Some(field) = &mut (*node).init { walk_for_statement_init(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FOR_STATEMENT_TEST) - as *mut Option) - { + if let Some(field) = &mut (*node).test { ctx.retag_stack(AncestorType::ForStatementTest); walk_expression(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FOR_STATEMENT_UPDATE) - as *mut Option) - { + if let Some(field) = &mut (*node).update { ctx.retag_stack(AncestorType::ForStatementUpdate); walk_expression(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::ForStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_for_statement(&mut *node, ctx); @@ -1733,31 +1454,16 @@ unsafe fn walk_for_in_statement<'a, Tr: Traverse<'a>>( ) { traverser.enter_for_in_statement(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_FOR_IN_STATEMENT_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::ForInStatementLeft( ancestor::ForInStatementWithoutLeft(node, PhantomData), )); - walk_for_statement_left( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_IN_STATEMENT_LEFT) as *mut ForStatementLeft, - ctx, - ); + walk_for_statement_left(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::ForInStatementRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_IN_STATEMENT_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.retag_stack(AncestorType::ForInStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_IN_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_for_in_statement(&mut *node, ctx); @@ -1797,31 +1503,16 @@ unsafe fn walk_for_of_statement<'a, Tr: Traverse<'a>>( ) { traverser.enter_for_of_statement(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_FOR_OF_STATEMENT_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::ForOfStatementLeft( ancestor::ForOfStatementWithoutLeft(node, PhantomData), )); - walk_for_statement_left( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_OF_STATEMENT_LEFT) as *mut ForStatementLeft, - ctx, - ); + walk_for_statement_left(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::ForOfStatementRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_OF_STATEMENT_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.retag_stack(AncestorType::ForOfStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FOR_OF_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_for_of_statement(&mut *node, ctx); @@ -1836,9 +1527,7 @@ unsafe fn walk_continue_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ContinueStatementLabel( ancestor::ContinueStatementWithoutLabel(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_CONTINUE_STATEMENT_LABEL) - as *mut Option) - { + if let Some(field) = &mut (*node).label { walk_label_identifier(traverser, field as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1854,9 +1543,7 @@ unsafe fn walk_break_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::BreakStatementLabel( ancestor::BreakStatementWithoutLabel(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_BREAK_STATEMENT_LABEL) - as *mut Option) - { + if let Some(field) = &mut (*node).label { walk_label_identifier(traverser, field as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1872,9 +1559,7 @@ unsafe fn walk_return_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ReturnStatementArgument( ancestor::ReturnStatementWithoutArgument(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_RETURN_STATEMENT_ARGUMENT) - as *mut Option) - { + if let Some(field) = &mut (*node).argument { walk_expression(traverser, field as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1890,17 +1575,9 @@ unsafe fn walk_with_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::WithStatementObject( ancestor::WithStatementWithoutObject(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_WITH_STATEMENT_OBJECT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).object), ctx); ctx.retag_stack(AncestorType::WithStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_WITH_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); traverser.exit_with_statement(&mut *node, ctx); } @@ -1914,21 +1591,12 @@ unsafe fn walk_switch_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::SwitchStatementDiscriminant( ancestor::SwitchStatementWithoutDiscriminant(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_SWITCH_STATEMENT_DISCRIMINANT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).discriminant), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_SWITCH_STATEMENT_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); ctx.retag_stack(AncestorType::SwitchStatementCases); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_SWITCH_STATEMENT_CASES) - as *mut Vec) - { + for item in &mut (*node).cases { walk_switch_case(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -1944,17 +1612,11 @@ unsafe fn walk_switch_case<'a, Tr: Traverse<'a>>( traverser.enter_switch_case(&mut *node, ctx); let pop_token = ctx .push_stack(Ancestor::SwitchCaseTest(ancestor::SwitchCaseWithoutTest(node, PhantomData))); - if let Some(field) = - &mut *((node as *mut u8).add(ancestor::OFFSET_SWITCH_CASE_TEST) as *mut Option) - { + if let Some(field) = &mut (*node).test { walk_expression(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::SwitchCaseConsequent); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_SWITCH_CASE_CONSEQUENT) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).consequent), ctx); ctx.pop_stack(pop_token); traverser.exit_switch_case(&mut *node, ctx); } @@ -1968,17 +1630,9 @@ unsafe fn walk_labeled_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::LabeledStatementLabel( ancestor::LabeledStatementWithoutLabel(node, PhantomData), )); - walk_label_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_LABELED_STATEMENT_LABEL) as *mut LabelIdentifier, - ctx, - ); + walk_label_identifier(traverser, from_mut(&mut (*node).label), ctx); ctx.retag_stack(AncestorType::LabeledStatementBody); - walk_statement( - traverser, - (node as *mut u8).add(ancestor::OFFSET_LABELED_STATEMENT_BODY) as *mut Statement, - ctx, - ); + walk_statement(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); traverser.exit_labeled_statement(&mut *node, ctx); } @@ -1992,11 +1646,7 @@ unsafe fn walk_throw_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ThrowStatementArgument( ancestor::ThrowStatementWithoutArgument(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_THROW_STATEMENT_ARGUMENT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_throw_statement(&mut *node, ctx); } @@ -2010,21 +1660,12 @@ unsafe fn walk_try_statement<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TryStatementBlock( ancestor::TryStatementWithoutBlock(node, PhantomData), )); - walk_block_statement( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TRY_STATEMENT_BLOCK) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TRY_STATEMENT_HANDLER) - as *mut Option>) - { + walk_block_statement(traverser, from_mut(&mut *((*node).block)), ctx); + if let Some(field) = &mut (*node).handler { ctx.retag_stack(AncestorType::TryStatementHandler); walk_catch_clause(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TRY_STATEMENT_FINALIZER) - as *mut Option>) - { + if let Some(field) = &mut (*node).finalizer { ctx.retag_stack(AncestorType::TryStatementFinalizer); walk_block_statement(traverser, (&mut **field) as *mut _, ctx); } @@ -2039,27 +1680,17 @@ unsafe fn walk_catch_clause<'a, Tr: Traverse<'a>>( ) { traverser.enter_catch_clause(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_CATCH_CLAUSE_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::CatchClauseParam(ancestor::CatchClauseWithoutParam( node, PhantomData, ))); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_CATCH_CLAUSE_PARAM) - as *mut Option) - { + if let Some(field) = &mut (*node).param { walk_catch_parameter(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::CatchClauseBody); - walk_block_statement( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_CATCH_CLAUSE_BODY) - as *mut Box)) as *mut _, - ctx, - ); + walk_block_statement(traverser, from_mut(&mut *((*node).body)), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_catch_clause(&mut *node, ctx); @@ -2074,11 +1705,7 @@ unsafe fn walk_catch_parameter<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::CatchParameterPattern( ancestor::CatchParameterWithoutPattern(node, PhantomData), )); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_CATCH_PARAMETER_PATTERN) as *mut BindingPattern, - ctx, - ); + walk_binding_pattern(traverser, from_mut(&mut (*node).pattern), ctx); ctx.pop_stack(pop_token); traverser.exit_catch_parameter(&mut *node, ctx); } @@ -2101,15 +1728,8 @@ unsafe fn walk_binding_pattern<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::BindingPatternKind( ancestor::BindingPatternWithoutKind(node, PhantomData), )); - walk_binding_pattern_kind( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINDING_PATTERN_KIND) as *mut BindingPatternKind, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_BINDING_PATTERN_TYPE_ANNOTATION) - as *mut Option>) - { + walk_binding_pattern_kind(traverser, from_mut(&mut (*node).kind), ctx); + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::BindingPatternTypeAnnotation); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -2149,17 +1769,9 @@ unsafe fn walk_assignment_pattern<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AssignmentPatternLeft( ancestor::AssignmentPatternWithoutLeft(node, PhantomData), )); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_PATTERN_LEFT) as *mut BindingPattern, - ctx, - ); + walk_binding_pattern(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::AssignmentPatternRight); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ASSIGNMENT_PATTERN_RIGHT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_assignment_pattern(&mut *node, ctx); } @@ -2173,14 +1785,10 @@ unsafe fn walk_object_pattern<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ObjectPatternProperties( ancestor::ObjectPatternWithoutProperties(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_OBJECT_PATTERN_PROPERTIES) - as *mut Vec) - { + for item in &mut (*node).properties { walk_binding_property(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_OBJECT_PATTERN_REST) - as *mut Option>) - { + if let Some(field) = &mut (*node).rest { ctx.retag_stack(AncestorType::ObjectPatternRest); walk_binding_rest_element(traverser, (&mut **field) as *mut _, ctx); } @@ -2197,17 +1805,9 @@ unsafe fn walk_binding_property<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::BindingPropertyKey( ancestor::BindingPropertyWithoutKey(node, PhantomData), )); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINDING_PROPERTY_KEY) as *mut PropertyKey, - ctx, - ); + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); ctx.retag_stack(AncestorType::BindingPropertyValue); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINDING_PROPERTY_VALUE) as *mut BindingPattern, - ctx, - ); + walk_binding_pattern(traverser, from_mut(&mut (*node).value), ctx); ctx.pop_stack(pop_token); traverser.exit_binding_property(&mut *node, ctx); } @@ -2221,16 +1821,10 @@ unsafe fn walk_array_pattern<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ArrayPatternElements( ancestor::ArrayPatternWithoutElements(node, PhantomData), )); - for item in (*((node as *mut u8).add(ancestor::OFFSET_ARRAY_PATTERN_ELEMENTS) - as *mut Vec>)) - .iter_mut() - .flatten() - { + for item in (*node).elements.iter_mut().flatten() { walk_binding_pattern(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_ARRAY_PATTERN_REST) - as *mut Option>) - { + if let Some(field) = &mut (*node).rest { ctx.retag_stack(AncestorType::ArrayPatternRest); walk_binding_rest_element(traverser, (&mut **field) as *mut _, ctx); } @@ -2247,12 +1841,7 @@ unsafe fn walk_binding_rest_element<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::BindingRestElementArgument( ancestor::BindingRestElementWithoutArgument(node, PhantomData), )); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_BINDING_REST_ELEMENT_ARGUMENT) - as *mut BindingPattern, - ctx, - ); + walk_binding_pattern(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_binding_rest_element(&mut *node, ctx); } @@ -2264,10 +1853,7 @@ unsafe fn walk_function<'a, Tr: Traverse<'a>>( ) { traverser.enter_function(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_FUNCTION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_hoist_scope_id = ctx.current_hoist_scope_id(); ctx.set_current_hoist_scope_id(current_scope_id); @@ -2275,39 +1861,24 @@ unsafe fn walk_function<'a, Tr: Traverse<'a>>( ctx.set_current_block_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::FunctionId(ancestor::FunctionWithoutId(node, PhantomData))); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_ID) - as *mut Option) - { + if let Some(field) = &mut (*node).id { walk_binding_identifier(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::FunctionTypeParameters); walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_THIS_PARAM) - as *mut Option>) - { + if let Some(field) = &mut (*node).this_param { ctx.retag_stack(AncestorType::FunctionThisParam); walk_ts_this_parameter(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::FunctionParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_FUNCTION_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_RETURN_TYPE) - as *mut Option>) - { + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); + if let Some(field) = &mut (*node).return_type { ctx.retag_stack(AncestorType::FunctionReturnType); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_BODY) - as *mut Option>) - { + if let Some(field) = &mut (*node).body { ctx.retag_stack(AncestorType::FunctionBody); walk_function_body(traverser, (&mut **field) as *mut _, ctx); } @@ -2327,14 +1898,10 @@ unsafe fn walk_formal_parameters<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::FormalParametersItems( ancestor::FormalParametersWithoutItems(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_FORMAL_PARAMETERS_ITEMS) - as *mut Vec) - { + for item in &mut (*node).items { walk_formal_parameter(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_FORMAL_PARAMETERS_REST) - as *mut Option>) - { + if let Some(field) = &mut (*node).rest { ctx.retag_stack(AncestorType::FormalParametersRest); walk_binding_rest_element(traverser, (&mut **field) as *mut _, ctx); } @@ -2351,17 +1918,11 @@ unsafe fn walk_formal_parameter<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::FormalParameterDecorators( ancestor::FormalParameterWithoutDecorators(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_FORMAL_PARAMETER_DECORATORS) - as *mut Vec) - { + for item in &mut (*node).decorators { walk_decorator(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::FormalParameterPattern); - walk_binding_pattern( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FORMAL_PARAMETER_PATTERN) as *mut BindingPattern, - ctx, - ); + walk_binding_pattern(traverser, from_mut(&mut (*node).pattern), ctx); ctx.pop_stack(pop_token); traverser.exit_formal_parameter(&mut *node, ctx); } @@ -2375,17 +1936,11 @@ unsafe fn walk_function_body<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::FunctionBodyDirectives( ancestor::FunctionBodyWithoutDirectives(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_FUNCTION_BODY_DIRECTIVES) - as *mut Vec) - { + for item in &mut (*node).directives { walk_directive(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::FunctionBodyStatements); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_FUNCTION_BODY_STATEMENTS) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).statements), ctx); ctx.pop_stack(pop_token); traverser.exit_function_body(&mut *node, ctx); } @@ -2397,11 +1952,7 @@ unsafe fn walk_arrow_function_expression<'a, Tr: Traverse<'a>>( ) { traverser.enter_arrow_function_expression(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8) - .add(ancestor::OFFSET_ARROW_FUNCTION_EXPRESSION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_hoist_scope_id = ctx.current_hoist_scope_id(); ctx.set_current_hoist_scope_id(current_scope_id); @@ -2410,33 +1961,17 @@ unsafe fn walk_arrow_function_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ArrowFunctionExpressionTypeParameters( ancestor::ArrowFunctionExpressionWithoutTypeParameters(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_ARROW_FUNCTION_EXPRESSION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::ArrowFunctionExpressionParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_ARROW_FUNCTION_EXPRESSION_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_ARROW_FUNCTION_EXPRESSION_RETURN_TYPE) - as *mut Option>) - { + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); + if let Some(field) = &mut (*node).return_type { ctx.retag_stack(AncestorType::ArrowFunctionExpressionReturnType); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::ArrowFunctionExpressionBody); - walk_function_body( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_ARROW_FUNCTION_EXPRESSION_BODY) - as *mut Box)) as *mut _, - ctx, - ); + walk_function_body(traverser, from_mut(&mut *((*node).body)), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); ctx.set_current_hoist_scope_id(previous_hoist_scope_id); @@ -2453,9 +1988,7 @@ unsafe fn walk_yield_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::YieldExpressionArgument( ancestor::YieldExpressionWithoutArgument(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_YIELD_EXPRESSION_ARGUMENT) - as *mut Option) - { + if let Some(field) = &mut (*node).argument { walk_expression(traverser, field as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -2470,56 +2003,36 @@ unsafe fn walk_class<'a, Tr: Traverse<'a>>( traverser.enter_class(&mut *node, ctx); let pop_token = ctx .push_stack(Ancestor::ClassDecorators(ancestor::ClassWithoutDecorators(node, PhantomData))); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_DECORATORS) as *mut Vec) - { + for item in &mut (*node).decorators { walk_decorator(traverser, item as *mut _, ctx); } - if let Some(field) = - &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_ID) as *mut Option) - { + if let Some(field) = &mut (*node).id { ctx.retag_stack(AncestorType::ClassId); walk_binding_identifier(traverser, field as *mut _, ctx); } let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_CLASS_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::ClassTypeParameters); walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = - &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_SUPER_CLASS) as *mut Option) - { + if let Some(field) = &mut (*node).super_class { ctx.retag_stack(AncestorType::ClassSuperClass); walk_expression(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_SUPER_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).super_type_parameters { ctx.retag_stack(AncestorType::ClassSuperTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_IMPLEMENTS) - as *mut Option>) - { + if let Some(field) = &mut (*node).implements { ctx.retag_stack(AncestorType::ClassImplements); for item in field.iter_mut() { walk_ts_class_implements(traverser, item as *mut _, ctx); } } ctx.retag_stack(AncestorType::ClassBody); - walk_class_body( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_CLASS_BODY) as *mut Box)) - as *mut _, - ctx, - ); + walk_class_body(traverser, from_mut(&mut *((*node).body)), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_class(&mut *node, ctx); @@ -2533,9 +2046,7 @@ unsafe fn walk_class_body<'a, Tr: Traverse<'a>>( traverser.enter_class_body(&mut *node, ctx); let pop_token = ctx.push_stack(Ancestor::ClassBodyBody(ancestor::ClassBodyWithoutBody(node, PhantomData))); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_CLASS_BODY_BODY) as *mut Vec) - { + for item in &mut (*node).body { walk_class_element(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -2577,24 +2088,13 @@ unsafe fn walk_method_definition<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::MethodDefinitionDecorators( ancestor::MethodDefinitionWithoutDecorators(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_METHOD_DEFINITION_DECORATORS) - as *mut Vec) - { + for item in &mut (*node).decorators { walk_decorator(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::MethodDefinitionKey); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_METHOD_DEFINITION_KEY) as *mut PropertyKey, - ctx, - ); + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); ctx.retag_stack(AncestorType::MethodDefinitionValue); - walk_function( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_METHOD_DEFINITION_VALUE) - as *mut Box)) as *mut _, - ctx, - ); + walk_function(traverser, from_mut(&mut *((*node).value)), ctx); ctx.pop_stack(pop_token); traverser.exit_method_definition(&mut *node, ctx); } @@ -2608,27 +2108,16 @@ unsafe fn walk_property_definition<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::PropertyDefinitionDecorators( ancestor::PropertyDefinitionWithoutDecorators(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_PROPERTY_DEFINITION_DECORATORS) - as *mut Vec) - { + for item in &mut (*node).decorators { walk_decorator(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::PropertyDefinitionKey); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_PROPERTY_DEFINITION_KEY) as *mut PropertyKey, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_PROPERTY_DEFINITION_VALUE) - as *mut Option) - { + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); + if let Some(field) = &mut (*node).value { ctx.retag_stack(AncestorType::PropertyDefinitionValue); walk_expression(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_PROPERTY_DEFINITION_TYPE_ANNOTATION) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::PropertyDefinitionTypeAnnotation); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -2652,10 +2141,7 @@ unsafe fn walk_static_block<'a, Tr: Traverse<'a>>( ) { traverser.enter_static_block(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_STATIC_BLOCK_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_hoist_scope_id = ctx.current_hoist_scope_id(); ctx.set_current_hoist_scope_id(current_scope_id); @@ -2663,11 +2149,7 @@ unsafe fn walk_static_block<'a, Tr: Traverse<'a>>( ctx.set_current_block_scope_id(current_scope_id); let pop_token = ctx .push_stack(Ancestor::StaticBlockBody(ancestor::StaticBlockWithoutBody(node, PhantomData))); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_STATIC_BLOCK_BODY) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); ctx.set_current_hoist_scope_id(previous_hoist_scope_id); @@ -2713,27 +2195,16 @@ unsafe fn walk_accessor_property<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::AccessorPropertyDecorators( ancestor::AccessorPropertyWithoutDecorators(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_ACCESSOR_PROPERTY_DECORATORS) - as *mut Vec) - { + for item in &mut (*node).decorators { walk_decorator(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::AccessorPropertyKey); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_ACCESSOR_PROPERTY_KEY) as *mut PropertyKey, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_ACCESSOR_PROPERTY_VALUE) - as *mut Option) - { + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); + if let Some(field) = &mut (*node).value { ctx.retag_stack(AncestorType::AccessorPropertyValue); walk_expression(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_ACCESSOR_PROPERTY_TYPE_ANNOTATION) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::AccessorPropertyTypeAnnotation); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -2750,15 +2221,9 @@ unsafe fn walk_import_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportExpressionSource( ancestor::ImportExpressionWithoutSource(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_EXPRESSION_SOURCE) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).source), ctx); ctx.retag_stack(AncestorType::ImportExpressionArguments); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_IMPORT_EXPRESSION_ARGUMENTS) - as *mut Vec) - { + for item in &mut (*node).arguments { walk_expression(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -2774,24 +2239,14 @@ unsafe fn walk_import_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportDeclarationSpecifiers( ancestor::ImportDeclarationWithoutSpecifiers(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_IMPORT_DECLARATION_SPECIFIERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).specifiers { for item in field.iter_mut() { walk_import_declaration_specifier(traverser, item as *mut _, ctx); } } ctx.retag_stack(AncestorType::ImportDeclarationSource); - walk_string_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_DECLARATION_SOURCE) as *mut StringLiteral, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_IMPORT_DECLARATION_WITH_CLAUSE) - as *mut Option>) - { + walk_string_literal(traverser, from_mut(&mut (*node).source), ctx); + if let Some(field) = &mut (*node).with_clause { ctx.retag_stack(AncestorType::ImportDeclarationWithClause); walk_with_clause(traverser, (&mut **field) as *mut _, ctx); } @@ -2828,17 +2283,9 @@ unsafe fn walk_import_specifier<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportSpecifierImported( ancestor::ImportSpecifierWithoutImported(node, PhantomData), )); - walk_module_export_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_SPECIFIER_IMPORTED) as *mut ModuleExportName, - ctx, - ); + walk_module_export_name(traverser, from_mut(&mut (*node).imported), ctx); ctx.retag_stack(AncestorType::ImportSpecifierLocal); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_SPECIFIER_LOCAL) as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).local), ctx); ctx.pop_stack(pop_token); traverser.exit_import_specifier(&mut *node, ctx); } @@ -2852,12 +2299,7 @@ unsafe fn walk_import_default_specifier<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportDefaultSpecifierLocal( ancestor::ImportDefaultSpecifierWithoutLocal(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_DEFAULT_SPECIFIER_LOCAL) - as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).local), ctx); ctx.pop_stack(pop_token); traverser.exit_import_default_specifier(&mut *node, ctx); } @@ -2871,12 +2313,7 @@ unsafe fn walk_import_namespace_specifier<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportNamespaceSpecifierLocal( ancestor::ImportNamespaceSpecifierWithoutLocal(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_NAMESPACE_SPECIFIER_LOCAL) - as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).local), ctx); ctx.pop_stack(pop_token); traverser.exit_import_namespace_specifier(&mut *node, ctx); } @@ -2890,16 +2327,9 @@ unsafe fn walk_with_clause<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::WithClauseAttributesKeyword( ancestor::WithClauseWithoutAttributesKeyword(node, PhantomData), )); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_WITH_CLAUSE_ATTRIBUTES_KEYWORD) - as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).attributes_keyword), ctx); ctx.retag_stack(AncestorType::WithClauseWithEntries); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_WITH_CLAUSE_WITH_ENTRIES) - as *mut Vec) - { + for item in &mut (*node).with_entries { walk_import_attribute(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -2915,17 +2345,9 @@ unsafe fn walk_import_attribute<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ImportAttributeKey( ancestor::ImportAttributeWithoutKey(node, PhantomData), )); - walk_import_attribute_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_ATTRIBUTE_KEY) as *mut ImportAttributeKey, - ctx, - ); + walk_import_attribute_key(traverser, from_mut(&mut (*node).key), ctx); ctx.retag_stack(AncestorType::ImportAttributeValue); - walk_string_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_IMPORT_ATTRIBUTE_VALUE) as *mut StringLiteral, - ctx, - ); + walk_string_literal(traverser, from_mut(&mut (*node).value), ctx); ctx.pop_stack(pop_token); traverser.exit_import_attribute(&mut *node, ctx); } @@ -2956,29 +2378,18 @@ unsafe fn walk_export_named_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ExportNamedDeclarationDeclaration( ancestor::ExportNamedDeclarationWithoutDeclaration(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_EXPORT_NAMED_DECLARATION_DECLARATION) - as *mut Option) - { + if let Some(field) = &mut (*node).declaration { walk_declaration(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::ExportNamedDeclarationSpecifiers); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_EXPORT_NAMED_DECLARATION_SPECIFIERS) - as *mut Vec) - { + for item in &mut (*node).specifiers { walk_export_specifier(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_EXPORT_NAMED_DECLARATION_SOURCE) - as *mut Option) - { + if let Some(field) = &mut (*node).source { ctx.retag_stack(AncestorType::ExportNamedDeclarationSource); walk_string_literal(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_EXPORT_NAMED_DECLARATION_WITH_CLAUSE) - as *mut Option>) - { + if let Some(field) = &mut (*node).with_clause { ctx.retag_stack(AncestorType::ExportNamedDeclarationWithClause); walk_with_clause(traverser, (&mut **field) as *mut _, ctx); } @@ -2995,19 +2406,9 @@ unsafe fn walk_export_default_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ExportDefaultDeclarationDeclaration( ancestor::ExportDefaultDeclarationWithoutDeclaration(node, PhantomData), )); - walk_export_default_declaration_kind( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPORT_DEFAULT_DECLARATION_DECLARATION) - as *mut ExportDefaultDeclarationKind, - ctx, - ); + walk_export_default_declaration_kind(traverser, from_mut(&mut (*node).declaration), ctx); ctx.retag_stack(AncestorType::ExportDefaultDeclarationExported); - walk_module_export_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPORT_DEFAULT_DECLARATION_EXPORTED) - as *mut ModuleExportName, - ctx, - ); + walk_module_export_name(traverser, from_mut(&mut (*node).exported), ctx); ctx.pop_stack(pop_token); traverser.exit_export_default_declaration(&mut *node, ctx); } @@ -3021,22 +2422,12 @@ unsafe fn walk_export_all_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ExportAllDeclarationExported( ancestor::ExportAllDeclarationWithoutExported(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_EXPORT_ALL_DECLARATION_EXPORTED) - as *mut Option) - { + if let Some(field) = &mut (*node).exported { walk_module_export_name(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::ExportAllDeclarationSource); - walk_string_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPORT_ALL_DECLARATION_SOURCE) as *mut StringLiteral, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_EXPORT_ALL_DECLARATION_WITH_CLAUSE) - as *mut Option>) - { + walk_string_literal(traverser, from_mut(&mut (*node).source), ctx); + if let Some(field) = &mut (*node).with_clause { ctx.retag_stack(AncestorType::ExportAllDeclarationWithClause); walk_with_clause(traverser, (&mut **field) as *mut _, ctx); } @@ -3053,17 +2444,9 @@ unsafe fn walk_export_specifier<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::ExportSpecifierLocal( ancestor::ExportSpecifierWithoutLocal(node, PhantomData), )); - walk_module_export_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPORT_SPECIFIER_LOCAL) as *mut ModuleExportName, - ctx, - ); + walk_module_export_name(traverser, from_mut(&mut (*node).local), ctx); ctx.retag_stack(AncestorType::ExportSpecifierExported); - walk_module_export_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_EXPORT_SPECIFIER_EXPORTED) as *mut ModuleExportName, - ctx, - ); + walk_module_export_name(traverser, from_mut(&mut (*node).exported), ctx); ctx.pop_stack(pop_token); traverser.exit_export_specifier(&mut *node, ctx); } @@ -3161,22 +2544,13 @@ unsafe fn walk_jsx_element<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXElementOpeningElement( ancestor::JSXElementWithoutOpeningElement(node, PhantomData), )); - walk_jsx_opening_element( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_JSX_ELEMENT_OPENING_ELEMENT) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_JSX_ELEMENT_CLOSING_ELEMENT) - as *mut Option>) - { + walk_jsx_opening_element(traverser, from_mut(&mut *((*node).opening_element)), ctx); + if let Some(field) = &mut (*node).closing_element { ctx.retag_stack(AncestorType::JSXElementClosingElement); walk_jsx_closing_element(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::JSXElementChildren); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_JSX_ELEMENT_CHILDREN) as *mut Vec) - { + for item in &mut (*node).children { walk_jsx_child(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3192,21 +2566,12 @@ unsafe fn walk_jsx_opening_element<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXOpeningElementName( ancestor::JSXOpeningElementWithoutName(node, PhantomData), )); - walk_jsx_element_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_OPENING_ELEMENT_NAME) as *mut JSXElementName, - ctx, - ); + walk_jsx_element_name(traverser, from_mut(&mut (*node).name), ctx); ctx.retag_stack(AncestorType::JSXOpeningElementAttributes); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_JSX_OPENING_ELEMENT_ATTRIBUTES) - as *mut Vec) - { + for item in &mut (*node).attributes { walk_jsx_attribute_item(traverser, item as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_JSX_OPENING_ELEMENT_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::JSXOpeningElementTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -3223,11 +2588,7 @@ unsafe fn walk_jsx_closing_element<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXClosingElementName( ancestor::JSXClosingElementWithoutName(node, PhantomData), )); - walk_jsx_element_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_CLOSING_ELEMENT_NAME) as *mut JSXElementName, - ctx, - ); + walk_jsx_element_name(traverser, from_mut(&mut (*node).name), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_closing_element(&mut *node, ctx); } @@ -3241,9 +2602,7 @@ unsafe fn walk_jsx_fragment<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXFragmentChildren( ancestor::JSXFragmentWithoutChildren(node, PhantomData), )); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_JSX_FRAGMENT_CHILDREN) as *mut Vec) - { + for item in &mut (*node).children { walk_jsx_child(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3285,17 +2644,9 @@ unsafe fn walk_jsx_namespaced_name<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXNamespacedNameNamespace( ancestor::JSXNamespacedNameWithoutNamespace(node, PhantomData), )); - walk_jsx_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_NAMESPACED_NAME_NAMESPACE) as *mut JSXIdentifier, - ctx, - ); + walk_jsx_identifier(traverser, from_mut(&mut (*node).namespace), ctx); ctx.retag_stack(AncestorType::JSXNamespacedNameProperty); - walk_jsx_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_NAMESPACED_NAME_PROPERTY) as *mut JSXIdentifier, - ctx, - ); + walk_jsx_identifier(traverser, from_mut(&mut (*node).property), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_namespaced_name(&mut *node, ctx); } @@ -3309,19 +2660,9 @@ unsafe fn walk_jsx_member_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXMemberExpressionObject( ancestor::JSXMemberExpressionWithoutObject(node, PhantomData), )); - walk_jsx_member_expression_object( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_MEMBER_EXPRESSION_OBJECT) - as *mut JSXMemberExpressionObject, - ctx, - ); + walk_jsx_member_expression_object(traverser, from_mut(&mut (*node).object), ctx); ctx.retag_stack(AncestorType::JSXMemberExpressionProperty); - walk_jsx_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_MEMBER_EXPRESSION_PROPERTY) - as *mut JSXIdentifier, - ctx, - ); + walk_jsx_identifier(traverser, from_mut(&mut (*node).property), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_member_expression(&mut *node, ctx); } @@ -3355,12 +2696,7 @@ unsafe fn walk_jsx_expression_container<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXExpressionContainerExpression( ancestor::JSXExpressionContainerWithoutExpression(node, PhantomData), )); - walk_jsx_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_EXPRESSION_CONTAINER_EXPRESSION) - as *mut JSXExpression, - ctx, - ); + walk_jsx_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_expression_container(&mut *node, ctx); } @@ -3459,14 +2795,8 @@ unsafe fn walk_jsx_attribute<'a, Tr: Traverse<'a>>( node, PhantomData, ))); - walk_jsx_attribute_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_ATTRIBUTE_NAME) as *mut JSXAttributeName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_JSX_ATTRIBUTE_VALUE) - as *mut Option) - { + walk_jsx_attribute_name(traverser, from_mut(&mut (*node).name), ctx); + if let Some(field) = &mut (*node).value { ctx.retag_stack(AncestorType::JSXAttributeValue); walk_jsx_attribute_value(traverser, field as *mut _, ctx); } @@ -3483,11 +2813,7 @@ unsafe fn walk_jsx_spread_attribute<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXSpreadAttributeArgument( ancestor::JSXSpreadAttributeWithoutArgument(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_SPREAD_ATTRIBUTE_ARGUMENT) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).argument), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_spread_attribute(&mut *node, ctx); } @@ -3568,11 +2894,7 @@ unsafe fn walk_jsx_spread_child<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSXSpreadChildExpression( ancestor::JSXSpreadChildWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JSX_SPREAD_CHILD_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_jsx_spread_child(&mut *node, ctx); } @@ -3649,10 +2971,7 @@ unsafe fn walk_ts_this_parameter<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSThisParameterTypeAnnotation( ancestor::TSThisParameterWithoutTypeAnnotation(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_THIS_PARAMETER_TYPE_ANNOTATION) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_annotation { walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3668,21 +2987,12 @@ unsafe fn walk_ts_enum_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSEnumDeclarationId( ancestor::TSEnumDeclarationWithoutId(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_ENUM_DECLARATION_ID) as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).id), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_TS_ENUM_DECLARATION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); ctx.retag_stack(AncestorType::TSEnumDeclarationMembers); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_ENUM_DECLARATION_MEMBERS) - as *mut Vec) - { + for item in &mut (*node).members { walk_ts_enum_member(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3698,14 +3008,8 @@ unsafe fn walk_ts_enum_member<'a, Tr: Traverse<'a>>( traverser.enter_ts_enum_member(&mut *node, ctx); let pop_token = ctx .push_stack(Ancestor::TSEnumMemberId(ancestor::TSEnumMemberWithoutId(node, PhantomData))); - walk_ts_enum_member_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_ENUM_MEMBER_ID) as *mut TSEnumMemberName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_ENUM_MEMBER_INITIALIZER) - as *mut Option) - { + walk_ts_enum_member_name(traverser, from_mut(&mut (*node).id), ctx); + if let Some(field) = &mut (*node).initializer { ctx.retag_stack(AncestorType::TSEnumMemberInitializer); walk_expression(traverser, field as *mut _, ctx); } @@ -3739,11 +3043,7 @@ unsafe fn walk_ts_type_annotation<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeAnnotationTypeAnnotation( ancestor::TSTypeAnnotationWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_ANNOTATION_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_type_annotation(&mut *node, ctx); } @@ -3757,11 +3057,7 @@ unsafe fn walk_ts_literal_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSLiteralTypeLiteral( ancestor::TSLiteralTypeWithoutLiteral(node, PhantomData), )); - walk_ts_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_LITERAL_TYPE_LITERAL) as *mut TSLiteral, - ctx, - ); + walk_ts_literal(traverser, from_mut(&mut (*node).literal), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_literal_type(&mut *node, ctx); } @@ -3908,36 +3204,17 @@ unsafe fn walk_ts_conditional_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSConditionalTypeCheckType( ancestor::TSConditionalTypeWithoutCheckType(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_CONDITIONAL_TYPE_CHECK_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).check_type), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_TS_CONDITIONAL_TYPE_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); ctx.retag_stack(AncestorType::TSConditionalTypeExtendsType); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_CONDITIONAL_TYPE_EXTENDS_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).extends_type), ctx); ctx.retag_stack(AncestorType::TSConditionalTypeTrueType); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_CONDITIONAL_TYPE_TRUE_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).true_type), ctx); ctx.set_current_scope_id(previous_scope_id); ctx.retag_stack(AncestorType::TSConditionalTypeFalseType); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_CONDITIONAL_TYPE_FALSE_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).false_type), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_conditional_type(&mut *node, ctx); } @@ -3952,9 +3229,7 @@ unsafe fn walk_ts_union_type<'a, Tr: Traverse<'a>>( node, PhantomData, ))); - for item in - &mut *((node as *mut u8).add(ancestor::OFFSET_TS_UNION_TYPE_TYPES) as *mut Vec) - { + for item in &mut (*node).types { walk_ts_type(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3970,9 +3245,7 @@ unsafe fn walk_ts_intersection_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSIntersectionTypeTypes( ancestor::TSIntersectionTypeWithoutTypes(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_INTERSECTION_TYPE_TYPES) - as *mut Vec) - { + for item in &mut (*node).types { walk_ts_type(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -3988,12 +3261,7 @@ unsafe fn walk_ts_parenthesized_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSParenthesizedTypeTypeAnnotation( ancestor::TSParenthesizedTypeWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_PARENTHESIZED_TYPE_TYPE_ANNOTATION) - as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_parenthesized_type(&mut *node, ctx); } @@ -4007,11 +3275,7 @@ unsafe fn walk_ts_type_operator<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeOperatorTypeAnnotation( ancestor::TSTypeOperatorWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_OPERATOR_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_type_operator(&mut *node, ctx); } @@ -4025,11 +3289,7 @@ unsafe fn walk_ts_array_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSArrayTypeElementType( ancestor::TSArrayTypeWithoutElementType(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_ARRAY_TYPE_ELEMENT_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).element_type), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_array_type(&mut *node, ctx); } @@ -4043,17 +3303,9 @@ unsafe fn walk_ts_indexed_access_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSIndexedAccessTypeObjectType( ancestor::TSIndexedAccessTypeWithoutObjectType(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_INDEXED_ACCESS_TYPE_OBJECT_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).object_type), ctx); ctx.retag_stack(AncestorType::TSIndexedAccessTypeIndexType); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_INDEXED_ACCESS_TYPE_INDEX_TYPE) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).index_type), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_indexed_access_type(&mut *node, ctx); } @@ -4067,9 +3319,7 @@ unsafe fn walk_ts_tuple_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTupleTypeElementTypes( ancestor::TSTupleTypeWithoutElementTypes(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TUPLE_TYPE_ELEMENT_TYPES) - as *mut Vec) - { + for item in &mut (*node).element_types { walk_ts_tuple_element(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -4085,18 +3335,9 @@ unsafe fn walk_ts_named_tuple_member<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSNamedTupleMemberElementType( ancestor::TSNamedTupleMemberWithoutElementType(node, PhantomData), )); - walk_ts_tuple_element( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_NAMED_TUPLE_MEMBER_ELEMENT_TYPE) - as *mut TSTupleElement, - ctx, - ); + walk_ts_tuple_element(traverser, from_mut(&mut (*node).element_type), ctx); ctx.retag_stack(AncestorType::TSNamedTupleMemberLabel); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_NAMED_TUPLE_MEMBER_LABEL) as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).label), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_named_tuple_member(&mut *node, ctx); } @@ -4110,11 +3351,7 @@ unsafe fn walk_ts_optional_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSOptionalTypeTypeAnnotation( ancestor::TSOptionalTypeWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_OPTIONAL_TYPE_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_optional_type(&mut *node, ctx); } @@ -4128,11 +3365,7 @@ unsafe fn walk_ts_rest_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSRestTypeTypeAnnotation( ancestor::TSRestTypeWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_REST_TYPE_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_rest_type(&mut *node, ctx); } @@ -4326,15 +3559,8 @@ unsafe fn walk_ts_type_reference<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeReferenceTypeName( ancestor::TSTypeReferenceWithoutTypeName(node, PhantomData), )); - walk_ts_type_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_REFERENCE_TYPE_NAME) as *mut TSTypeName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_REFERENCE_TYPE_PARAMETERS) - as *mut Option>) - { + walk_ts_type_name(traverser, from_mut(&mut (*node).type_name), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSTypeReferenceTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -4368,17 +3594,9 @@ unsafe fn walk_ts_qualified_name<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSQualifiedNameLeft( ancestor::TSQualifiedNameWithoutLeft(node, PhantomData), )); - walk_ts_type_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_QUALIFIED_NAME_LEFT) as *mut TSTypeName, - ctx, - ); + walk_ts_type_name(traverser, from_mut(&mut (*node).left), ctx); ctx.retag_stack(AncestorType::TSQualifiedNameRight); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_QUALIFIED_NAME_RIGHT) as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).right), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_qualified_name(&mut *node, ctx); } @@ -4392,10 +3610,7 @@ unsafe fn walk_ts_type_parameter_instantiation<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeParameterInstantiationParams( ancestor::TSTypeParameterInstantiationWithoutParams(node, PhantomData), )); - for item in &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_PARAMETER_INSTANTIATION_PARAMS) - as *mut Vec) - { + for item in &mut (*node).params { walk_ts_type(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -4411,20 +3626,12 @@ unsafe fn walk_ts_type_parameter<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeParameterName( ancestor::TSTypeParameterWithoutName(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_PARAMETER_NAME) as *mut BindingIdentifier, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TYPE_PARAMETER_CONSTRAINT) - as *mut Option) - { + walk_binding_identifier(traverser, from_mut(&mut (*node).name), ctx); + if let Some(field) = &mut (*node).constraint { ctx.retag_stack(AncestorType::TSTypeParameterConstraint); walk_ts_type(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TYPE_PARAMETER_DEFAULT) - as *mut Option) - { + if let Some(field) = &mut (*node).default { ctx.retag_stack(AncestorType::TSTypeParameterDefault); walk_ts_type(traverser, field as *mut _, ctx); } @@ -4441,9 +3648,7 @@ unsafe fn walk_ts_type_parameter_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeParameterDeclarationParams( ancestor::TSTypeParameterDeclarationWithoutParams(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TYPE_PARAMETER_DECLARATION_PARAMS) - as *mut Vec) - { + for item in &mut (*node).params { walk_ts_type_parameter(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -4459,33 +3664,16 @@ unsafe fn walk_ts_type_alias_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeAliasDeclarationId( ancestor::TSTypeAliasDeclarationWithoutId(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_ALIAS_DECLARATION_ID) - as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).id), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_ALIAS_DECLARATION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSTypeAliasDeclarationTypeParameters); walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSTypeAliasDeclarationTypeAnnotation); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_ALIAS_DECLARATION_TYPE_ANNOTATION) - as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_ts_type_alias_declaration(&mut *node, ctx); @@ -4500,15 +3688,8 @@ unsafe fn walk_ts_class_implements<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSClassImplementsExpression( ancestor::TSClassImplementsWithoutExpression(node, PhantomData), )); - walk_ts_type_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_CLASS_IMPLEMENTS_EXPRESSION) as *mut TSTypeName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CLASS_IMPLEMENTS_TYPE_PARAMETERS) - as *mut Option>) - { + walk_ts_type_name(traverser, from_mut(&mut (*node).expression), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSClassImplementsTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -4525,42 +3706,22 @@ unsafe fn walk_ts_interface_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSInterfaceDeclarationId( ancestor::TSInterfaceDeclarationWithoutId(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_INTERFACE_DECLARATION_ID) - as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).id), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8) - .add(ancestor::OFFSET_TS_INTERFACE_DECLARATION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_INTERFACE_DECLARATION_EXTENDS) - as *mut Option>) - { + if let Some(field) = &mut (*node).extends { ctx.retag_stack(AncestorType::TSInterfaceDeclarationExtends); for item in field.iter_mut() { walk_ts_interface_heritage(traverser, item as *mut _, ctx); } } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_INTERFACE_DECLARATION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSInterfaceDeclarationTypeParameters); walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSInterfaceDeclarationBody); - walk_ts_interface_body( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_INTERFACE_DECLARATION_BODY) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_interface_body(traverser, from_mut(&mut *((*node).body)), ctx); ctx.pop_stack(pop_token); ctx.set_current_scope_id(previous_scope_id); traverser.exit_ts_interface_declaration(&mut *node, ctx); @@ -4575,9 +3736,7 @@ unsafe fn walk_ts_interface_body<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSInterfaceBodyBody( ancestor::TSInterfaceBodyWithoutBody(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_INTERFACE_BODY_BODY) - as *mut Vec) - { + for item in &mut (*node).body { walk_ts_signature(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -4593,15 +3752,8 @@ unsafe fn walk_ts_property_signature<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSPropertySignatureKey( ancestor::TSPropertySignatureWithoutKey(node, PhantomData), )); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_PROPERTY_SIGNATURE_KEY) as *mut PropertyKey, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_PROPERTY_SIGNATURE_TYPE_ANNOTATION) - as *mut Option>) - { + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::TSPropertySignatureTypeAnnotation); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -4644,18 +3796,11 @@ unsafe fn walk_ts_index_signature<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSIndexSignatureParameters( ancestor::TSIndexSignatureWithoutParameters(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_INDEX_SIGNATURE_PARAMETERS) - as *mut Vec) - { + for item in &mut (*node).parameters { walk_ts_index_signature_name(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::TSIndexSignatureTypeAnnotation); - walk_ts_type_annotation( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_INDEX_SIGNATURE_TYPE_ANNOTATION) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_annotation(traverser, from_mut(&mut *((*node).type_annotation)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_index_signature(&mut *node, ctx); } @@ -4669,30 +3814,16 @@ unsafe fn walk_ts_call_signature_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSCallSignatureDeclarationTypeParameters( ancestor::TSCallSignatureDeclarationWithoutTypeParameters(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CALL_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CALL_SIGNATURE_DECLARATION_THIS_PARAM) - as *mut Option) - { + if let Some(field) = &mut (*node).this_param { ctx.retag_stack(AncestorType::TSCallSignatureDeclarationThisParam); walk_ts_this_parameter(traverser, field as *mut _, ctx); } ctx.retag_stack(AncestorType::TSCallSignatureDeclarationParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_CALL_SIGNATURE_DECLARATION_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CALL_SIGNATURE_DECLARATION_RETURN_TYPE) - as *mut Option>) - { + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); + if let Some(field) = &mut (*node).return_type { ctx.retag_stack(AncestorType::TSCallSignatureDeclarationReturnType); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -4707,44 +3838,23 @@ unsafe fn walk_ts_method_signature<'a, Tr: Traverse<'a>>( ) { traverser.enter_ts_method_signature(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_TS_METHOD_SIGNATURE_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::TSMethodSignatureKey( ancestor::TSMethodSignatureWithoutKey(node, PhantomData), )); - walk_property_key( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_METHOD_SIGNATURE_KEY) as *mut PropertyKey, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_METHOD_SIGNATURE_TYPE_PARAMETERS) - as *mut Option>) - { + walk_property_key(traverser, from_mut(&mut (*node).key), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSMethodSignatureTypeParameters); walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_METHOD_SIGNATURE_THIS_PARAM) - as *mut Option>) - { + if let Some(field) = &mut (*node).this_param { ctx.retag_stack(AncestorType::TSMethodSignatureThisParam); walk_ts_this_parameter(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSMethodSignatureParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_METHOD_SIGNATURE_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_METHOD_SIGNATURE_RETURN_TYPE) - as *mut Option>) - { + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); + if let Some(field) = &mut (*node).return_type { ctx.retag_stack(AncestorType::TSMethodSignatureReturnType); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -4760,32 +3870,17 @@ unsafe fn walk_ts_construct_signature_declaration<'a, Tr: Traverse<'a>>( ) { traverser.enter_ts_construct_signature_declaration(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8) - .add(ancestor::OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::TSConstructSignatureDeclarationTypeParameters( ancestor::TSConstructSignatureDeclarationWithoutTypeParameters(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSConstructSignatureDeclarationParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CONSTRUCT_SIGNATURE_DECLARATION_RETURN_TYPE) - as *mut Option>) - { + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); + if let Some(field) = &mut (*node).return_type { ctx.retag_stack(AncestorType::TSConstructSignatureDeclarationReturnType); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -4803,12 +3898,7 @@ unsafe fn walk_ts_index_signature_name<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSIndexSignatureNameTypeAnnotation( ancestor::TSIndexSignatureNameWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type_annotation( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_INDEX_SIGNATURE_NAME_TYPE_ANNOTATION) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_annotation(traverser, from_mut(&mut *((*node).type_annotation)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_index_signature_name(&mut *node, ctx); } @@ -4822,15 +3912,8 @@ unsafe fn walk_ts_interface_heritage<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSInterfaceHeritageExpression( ancestor::TSInterfaceHeritageWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_INTERFACE_HERITAGE_EXPRESSION) as *mut Expression, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_INTERFACE_HERITAGE_TYPE_PARAMETERS) - as *mut Option>) - { + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSInterfaceHeritageTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -4847,16 +3930,8 @@ unsafe fn walk_ts_type_predicate<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypePredicateParameterName( ancestor::TSTypePredicateWithoutParameterName(node, PhantomData), )); - walk_ts_type_predicate_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_PREDICATE_PARAMETER_NAME) - as *mut TSTypePredicateName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_PREDICATE_TYPE_ANNOTATION) - as *mut Option>) - { + walk_ts_type_predicate_name(traverser, from_mut(&mut (*node).parameter_name), ctx); + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::TSTypePredicateTypeAnnotation); walk_ts_type_annotation(traverser, (&mut **field) as *mut _, ctx); } @@ -4888,26 +3963,15 @@ unsafe fn walk_ts_module_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSModuleDeclarationId( ancestor::TSModuleDeclarationWithoutId(node, PhantomData), )); - walk_ts_module_declaration_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_MODULE_DECLARATION_ID) - as *mut TSModuleDeclarationName, - ctx, - ); + walk_ts_module_declaration_name(traverser, from_mut(&mut (*node).id), ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = - (*((node as *mut u8).add(ancestor::OFFSET_TS_MODULE_DECLARATION_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let previous_hoist_scope_id = ctx.current_hoist_scope_id(); ctx.set_current_hoist_scope_id(current_scope_id); let previous_block_scope_id = ctx.current_block_scope_id(); ctx.set_current_block_scope_id(current_scope_id); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_MODULE_DECLARATION_BODY) - as *mut Option) - { + if let Some(field) = &mut (*node).body { ctx.retag_stack(AncestorType::TSModuleDeclarationBody); walk_ts_module_declaration_body(traverser, field as *mut _, ctx); } @@ -4961,17 +4025,11 @@ unsafe fn walk_ts_module_block<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSModuleBlockDirectives( ancestor::TSModuleBlockWithoutDirectives(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_MODULE_BLOCK_DIRECTIVES) - as *mut Vec) - { + for item in &mut (*node).directives { walk_directive(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::TSModuleBlockBody); - walk_statements( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_MODULE_BLOCK_BODY) as *mut Vec, - ctx, - ); + walk_statements(traverser, from_mut(&mut (*node).body), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_module_block(&mut *node, ctx); } @@ -4985,9 +4043,7 @@ unsafe fn walk_ts_type_literal<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeLiteralMembers( ancestor::TSTypeLiteralWithoutMembers(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TYPE_LITERAL_MEMBERS) - as *mut Vec) - { + for item in &mut (*node).members { walk_ts_signature(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -5003,12 +4059,7 @@ unsafe fn walk_ts_infer_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSInferTypeTypeParameter( ancestor::TSInferTypeWithoutTypeParameter(node, PhantomData), )); - walk_ts_type_parameter( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_INFER_TYPE_TYPE_PARAMETER) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_parameter(traverser, from_mut(&mut *((*node).type_parameter)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_infer_type(&mut *node, ctx); } @@ -5022,15 +4073,8 @@ unsafe fn walk_ts_type_query<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeQueryExprName( ancestor::TSTypeQueryWithoutExprName(node, PhantomData), )); - walk_ts_type_query_expr_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_QUERY_EXPR_NAME) as *mut TSTypeQueryExprName, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_TYPE_QUERY_TYPE_PARAMETERS) - as *mut Option>) - { + walk_ts_type_query_expr_name(traverser, from_mut(&mut (*node).expr_name), ctx); + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSTypeQueryTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -5064,27 +4108,16 @@ unsafe fn walk_ts_import_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSImportTypeParameter( ancestor::TSImportTypeWithoutParameter(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_PARAMETER) as *mut TSType, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_QUALIFIER) - as *mut Option) - { + walk_ts_type(traverser, from_mut(&mut (*node).parameter), ctx); + if let Some(field) = &mut (*node).qualifier { ctx.retag_stack(AncestorType::TSImportTypeQualifier); walk_ts_type_name(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_TYPE_ATTRIBUTES) - as *mut Option>) - { + if let Some(field) = &mut (*node).attributes { ctx.retag_stack(AncestorType::TSImportTypeAttributes); walk_ts_import_attributes(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_IMPORT_TYPE_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { ctx.retag_stack(AncestorType::TSImportTypeTypeParameters); walk_ts_type_parameter_instantiation(traverser, (&mut **field) as *mut _, ctx); } @@ -5101,16 +4134,9 @@ unsafe fn walk_ts_import_attributes<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSImportAttributesAttributesKeyword( ancestor::TSImportAttributesWithoutAttributesKeyword(node, PhantomData), )); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_ATTRIBUTES_ATTRIBUTES_KEYWORD) - as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).attributes_keyword), ctx); ctx.retag_stack(AncestorType::TSImportAttributesElements); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_ATTRIBUTES_ELEMENTS) - as *mut Vec) - { + for item in &mut (*node).elements { walk_ts_import_attribute(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -5126,18 +4152,9 @@ unsafe fn walk_ts_import_attribute<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSImportAttributeName( ancestor::TSImportAttributeWithoutName(node, PhantomData), )); - walk_ts_import_attribute_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_ATTRIBUTE_NAME) - as *mut TSImportAttributeName, - ctx, - ); + walk_ts_import_attribute_name(traverser, from_mut(&mut (*node).name), ctx); ctx.retag_stack(AncestorType::TSImportAttributeValue); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_ATTRIBUTE_VALUE) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).value), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_import_attribute(&mut *node, ctx); } @@ -5168,32 +4185,17 @@ unsafe fn walk_ts_function_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSFunctionTypeTypeParameters( ancestor::TSFunctionTypeWithoutTypeParameters(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_FUNCTION_TYPE_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_FUNCTION_TYPE_THIS_PARAM) - as *mut Option>) - { + if let Some(field) = &mut (*node).this_param { ctx.retag_stack(AncestorType::TSFunctionTypeThisParam); walk_ts_this_parameter(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSFunctionTypeParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_FUNCTION_TYPE_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); ctx.retag_stack(AncestorType::TSFunctionTypeReturnType); - walk_ts_type_annotation( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_FUNCTION_TYPE_RETURN_TYPE) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_annotation(traverser, from_mut(&mut *((*node).return_type)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_function_type(&mut *node, ctx); } @@ -5207,26 +4209,13 @@ unsafe fn walk_ts_constructor_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSConstructorTypeTypeParameters( ancestor::TSConstructorTypeWithoutTypeParameters(node, PhantomData), )); - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_CONSTRUCTOR_TYPE_TYPE_PARAMETERS) - as *mut Option>) - { + if let Some(field) = &mut (*node).type_parameters { walk_ts_type_parameter_declaration(traverser, (&mut **field) as *mut _, ctx); } ctx.retag_stack(AncestorType::TSConstructorTypeParams); - walk_formal_parameters( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_CONSTRUCTOR_TYPE_PARAMS) - as *mut Box)) as *mut _, - ctx, - ); + walk_formal_parameters(traverser, from_mut(&mut *((*node).params)), ctx); ctx.retag_stack(AncestorType::TSConstructorTypeReturnType); - walk_ts_type_annotation( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_CONSTRUCTOR_TYPE_RETURN_TYPE) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_annotation(traverser, from_mut(&mut *((*node).return_type)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_constructor_type(&mut *node, ctx); } @@ -5238,30 +4227,17 @@ unsafe fn walk_ts_mapped_type<'a, Tr: Traverse<'a>>( ) { traverser.enter_ts_mapped_type(&mut *node, ctx); let previous_scope_id = ctx.current_scope_id(); - let current_scope_id = (*((node as *mut u8).add(ancestor::OFFSET_TS_MAPPED_TYPE_SCOPE_ID) - as *mut Cell>)) - .get() - .unwrap(); + let current_scope_id = (*node).scope_id.get().unwrap(); ctx.set_current_scope_id(current_scope_id); let pop_token = ctx.push_stack(Ancestor::TSMappedTypeTypeParameter( ancestor::TSMappedTypeWithoutTypeParameter(node, PhantomData), )); - walk_ts_type_parameter( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_MAPPED_TYPE_TYPE_PARAMETER) - as *mut Box)) as *mut _, - ctx, - ); - if let Some(field) = &mut *((node as *mut u8).add(ancestor::OFFSET_TS_MAPPED_TYPE_NAME_TYPE) - as *mut Option) - { + walk_ts_type_parameter(traverser, from_mut(&mut *((*node).type_parameter)), ctx); + if let Some(field) = &mut (*node).name_type { ctx.retag_stack(AncestorType::TSMappedTypeNameType); walk_ts_type(traverser, field as *mut _, ctx); } - if let Some(field) = &mut *((node as *mut u8) - .add(ancestor::OFFSET_TS_MAPPED_TYPE_TYPE_ANNOTATION) - as *mut Option) - { + if let Some(field) = &mut (*node).type_annotation { ctx.retag_stack(AncestorType::TSMappedTypeTypeAnnotation); walk_ts_type(traverser, field as *mut _, ctx); } @@ -5279,15 +4255,11 @@ unsafe fn walk_ts_template_literal_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTemplateLiteralTypeQuasis( ancestor::TSTemplateLiteralTypeWithoutQuasis(node, PhantomData), )); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TEMPLATE_LITERAL_TYPE_QUASIS) - as *mut Vec) - { + for item in &mut (*node).quasis { walk_template_element(traverser, item as *mut _, ctx); } ctx.retag_stack(AncestorType::TSTemplateLiteralTypeTypes); - for item in &mut *((node as *mut u8).add(ancestor::OFFSET_TS_TEMPLATE_LITERAL_TYPE_TYPES) - as *mut Vec) - { + for item in &mut (*node).types { walk_ts_type(traverser, item as *mut _, ctx); } ctx.pop_stack(pop_token); @@ -5303,17 +4275,9 @@ unsafe fn walk_ts_as_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSAsExpressionExpression( ancestor::TSAsExpressionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_AS_EXPRESSION_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.retag_stack(AncestorType::TSAsExpressionTypeAnnotation); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_AS_EXPRESSION_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_as_expression(&mut *node, ctx); } @@ -5327,19 +4291,9 @@ unsafe fn walk_ts_satisfies_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSSatisfiesExpressionExpression( ancestor::TSSatisfiesExpressionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_SATISFIES_EXPRESSION_EXPRESSION) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.retag_stack(AncestorType::TSSatisfiesExpressionTypeAnnotation); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_SATISFIES_EXPRESSION_TYPE_ANNOTATION) - as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_satisfies_expression(&mut *node, ctx); } @@ -5353,17 +4307,9 @@ unsafe fn walk_ts_type_assertion<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSTypeAssertionExpression( ancestor::TSTypeAssertionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_ASSERTION_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.retag_stack(AncestorType::TSTypeAssertionTypeAnnotation); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_TYPE_ASSERTION_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_type_assertion(&mut *node, ctx); } @@ -5377,19 +4323,9 @@ unsafe fn walk_ts_import_equals_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSImportEqualsDeclarationId( ancestor::TSImportEqualsDeclarationWithoutId(node, PhantomData), )); - walk_binding_identifier( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_EQUALS_DECLARATION_ID) - as *mut BindingIdentifier, - ctx, - ); + walk_binding_identifier(traverser, from_mut(&mut (*node).id), ctx); ctx.retag_stack(AncestorType::TSImportEqualsDeclarationModuleReference); - walk_ts_module_reference( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_IMPORT_EQUALS_DECLARATION_MODULE_REFERENCE) - as *mut TSModuleReference, - ctx, - ); + walk_ts_module_reference(traverser, from_mut(&mut (*node).module_reference), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_import_equals_declaration(&mut *node, ctx); } @@ -5420,12 +4356,7 @@ unsafe fn walk_ts_external_module_reference<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSExternalModuleReferenceExpression( ancestor::TSExternalModuleReferenceWithoutExpression(node, PhantomData), )); - walk_string_literal( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_EXTERNAL_MODULE_REFERENCE_EXPRESSION) - as *mut StringLiteral, - ctx, - ); + walk_string_literal(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_external_module_reference(&mut *node, ctx); } @@ -5439,12 +4370,7 @@ unsafe fn walk_ts_non_null_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSNonNullExpressionExpression( ancestor::TSNonNullExpressionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_NON_NULL_EXPRESSION_EXPRESSION) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_non_null_expression(&mut *node, ctx); } @@ -5458,11 +4384,7 @@ unsafe fn walk_decorator<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::DecoratorExpression( ancestor::DecoratorWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_DECORATOR_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_decorator(&mut *node, ctx); } @@ -5476,11 +4398,7 @@ unsafe fn walk_ts_export_assignment<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSExportAssignmentExpression( ancestor::TSExportAssignmentWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_EXPORT_ASSIGNMENT_EXPRESSION) as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_export_assignment(&mut *node, ctx); } @@ -5494,12 +4412,7 @@ unsafe fn walk_ts_namespace_export_declaration<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSNamespaceExportDeclarationId( ancestor::TSNamespaceExportDeclarationWithoutId(node, PhantomData), )); - walk_identifier_name( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_NAMESPACE_EXPORT_DECLARATION_ID) - as *mut IdentifierName, - ctx, - ); + walk_identifier_name(traverser, from_mut(&mut (*node).id), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_namespace_export_declaration(&mut *node, ctx); } @@ -5513,19 +4426,9 @@ unsafe fn walk_ts_instantiation_expression<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::TSInstantiationExpressionExpression( ancestor::TSInstantiationExpressionWithoutExpression(node, PhantomData), )); - walk_expression( - traverser, - (node as *mut u8).add(ancestor::OFFSET_TS_INSTANTIATION_EXPRESSION_EXPRESSION) - as *mut Expression, - ctx, - ); + walk_expression(traverser, from_mut(&mut (*node).expression), ctx); ctx.retag_stack(AncestorType::TSInstantiationExpressionTypeParameters); - walk_ts_type_parameter_instantiation( - traverser, - (&mut **((node as *mut u8).add(ancestor::OFFSET_TS_INSTANTIATION_EXPRESSION_TYPE_PARAMETERS) - as *mut Box)) as *mut _, - ctx, - ); + walk_ts_type_parameter_instantiation(traverser, from_mut(&mut *((*node).type_parameters)), ctx); ctx.pop_stack(pop_token); traverser.exit_ts_instantiation_expression(&mut *node, ctx); } @@ -5539,11 +4442,7 @@ unsafe fn walk_js_doc_nullable_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSDocNullableTypeTypeAnnotation( ancestor::JSDocNullableTypeWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JS_DOC_NULLABLE_TYPE_TYPE_ANNOTATION) as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_js_doc_nullable_type(&mut *node, ctx); } @@ -5557,12 +4456,7 @@ unsafe fn walk_js_doc_non_nullable_type<'a, Tr: Traverse<'a>>( let pop_token = ctx.push_stack(Ancestor::JSDocNonNullableTypeTypeAnnotation( ancestor::JSDocNonNullableTypeWithoutTypeAnnotation(node, PhantomData), )); - walk_ts_type( - traverser, - (node as *mut u8).add(ancestor::OFFSET_JS_DOC_NON_NULLABLE_TYPE_TYPE_ANNOTATION) - as *mut TSType, - ctx, - ); + walk_ts_type(traverser, from_mut(&mut (*node).type_annotation), ctx); ctx.pop_stack(pop_token); traverser.exit_js_doc_non_nullable_type(&mut *node, ctx); }