Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions crates/oxc_ast/src/ast/js.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,13 @@ pub struct PropertyDefinition<'a> {
pub decorators: Vec<'a, Decorator<'a>>,
/// The expression used to declare the property.
pub key: PropertyKey<'a>,
/// Type annotation on the property.
///
/// e.g. `class Foo { x: number; }`
///
/// Will only ever be [`Some`] for TypeScript files.
#[ts]
pub type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
/// Initialized value in the declaration.
///
/// ## Example
Expand Down Expand Up @@ -2164,11 +2171,6 @@ pub struct PropertyDefinition<'a> {
/// `true` when declared with a `readonly` modifier
#[ts]
pub readonly: bool,
/// Type annotation on the property.
///
/// Will only ever be [`Some`] for TypeScript files.
#[ts]
pub type_annotation: Option<Box<'a, TSTypeAnnotation<'a>>>,
/// Accessibility modifier.
///
/// Only ever [`Some`] for TypeScript files.
Expand Down
44 changes: 22 additions & 22 deletions crates/oxc_ast/src/generated/assert_layouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,22 +604,22 @@ const _: () = {
assert!(size_of::<MethodDefinitionType>() == 1);
assert!(align_of::<MethodDefinitionType>() == 1);

assert!(size_of::<PropertyDefinition>() == 104);
assert!(size_of::<PropertyDefinition>() == 96);
assert!(align_of::<PropertyDefinition>() == 8);
assert!(offset_of!(PropertyDefinition, span) == 0);
assert!(offset_of!(PropertyDefinition, r#type) == 8);
assert!(offset_of!(PropertyDefinition, decorators) == 16);
assert!(offset_of!(PropertyDefinition, key) == 48);
assert!(offset_of!(PropertyDefinition, value) == 64);
assert!(offset_of!(PropertyDefinition, computed) == 80);
assert!(offset_of!(PropertyDefinition, r#static) == 81);
assert!(offset_of!(PropertyDefinition, declare) == 82);
assert!(offset_of!(PropertyDefinition, r#override) == 83);
assert!(offset_of!(PropertyDefinition, optional) == 84);
assert!(offset_of!(PropertyDefinition, definite) == 85);
assert!(offset_of!(PropertyDefinition, readonly) == 86);
assert!(offset_of!(PropertyDefinition, type_annotation) == 88);
assert!(offset_of!(PropertyDefinition, accessibility) == 96);
assert!(offset_of!(PropertyDefinition, type_annotation) == 64);
assert!(offset_of!(PropertyDefinition, value) == 72);
assert!(offset_of!(PropertyDefinition, computed) == 88);
assert!(offset_of!(PropertyDefinition, r#static) == 89);
assert!(offset_of!(PropertyDefinition, declare) == 90);
assert!(offset_of!(PropertyDefinition, r#override) == 91);
assert!(offset_of!(PropertyDefinition, optional) == 92);
assert!(offset_of!(PropertyDefinition, definite) == 93);
assert!(offset_of!(PropertyDefinition, readonly) == 94);
assert!(offset_of!(PropertyDefinition, accessibility) == 95);

assert!(size_of::<PropertyDefinitionType>() == 1);
assert!(align_of::<PropertyDefinitionType>() == 1);
Expand Down Expand Up @@ -1999,22 +1999,22 @@ const _: () = {
assert!(size_of::<MethodDefinitionType>() == 1);
assert!(align_of::<MethodDefinitionType>() == 1);

assert!(size_of::<PropertyDefinition>() == 60);
assert!(size_of::<PropertyDefinition>() == 56);
assert!(align_of::<PropertyDefinition>() == 4);
assert!(offset_of!(PropertyDefinition, span) == 0);
assert!(offset_of!(PropertyDefinition, r#type) == 8);
assert!(offset_of!(PropertyDefinition, decorators) == 12);
assert!(offset_of!(PropertyDefinition, key) == 28);
assert!(offset_of!(PropertyDefinition, value) == 36);
assert!(offset_of!(PropertyDefinition, computed) == 44);
assert!(offset_of!(PropertyDefinition, r#static) == 45);
assert!(offset_of!(PropertyDefinition, declare) == 46);
assert!(offset_of!(PropertyDefinition, r#override) == 47);
assert!(offset_of!(PropertyDefinition, optional) == 48);
assert!(offset_of!(PropertyDefinition, definite) == 49);
assert!(offset_of!(PropertyDefinition, readonly) == 50);
assert!(offset_of!(PropertyDefinition, type_annotation) == 52);
assert!(offset_of!(PropertyDefinition, accessibility) == 56);
assert!(offset_of!(PropertyDefinition, type_annotation) == 36);
assert!(offset_of!(PropertyDefinition, value) == 40);
assert!(offset_of!(PropertyDefinition, computed) == 48);
assert!(offset_of!(PropertyDefinition, r#static) == 49);
assert!(offset_of!(PropertyDefinition, declare) == 50);
assert!(offset_of!(PropertyDefinition, r#override) == 51);
assert!(offset_of!(PropertyDefinition, optional) == 52);
assert!(offset_of!(PropertyDefinition, definite) == 53);
assert!(offset_of!(PropertyDefinition, readonly) == 54);
assert!(offset_of!(PropertyDefinition, accessibility) == 55);

assert!(size_of::<PropertyDefinitionType>() == 1);
assert!(align_of::<PropertyDefinitionType>() == 1);
Expand Down
18 changes: 9 additions & 9 deletions crates/oxc_ast/src/generated/ast_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6590,6 +6590,7 @@ impl<'a> AstBuilder<'a> {
/// * `type`
/// * `decorators`: Decorators applied to the property.
/// * `key`: The expression used to declare the property.
/// * `type_annotation`: Type annotation on the property.
/// * `value`: Initialized value in the declaration.
/// * `computed`: Property was declared with a computed key
/// * `static`: Property was declared with a `static` modifier
Expand All @@ -6598,7 +6599,6 @@ impl<'a> AstBuilder<'a> {
/// * `optional`: `true` when created with an optional modifier (`?`)
/// * `definite`
/// * `readonly`: `true` when declared with a `readonly` modifier
/// * `type_annotation`: Type annotation on the property.
/// * `accessibility`: Accessibility modifier.
#[inline]
pub fn class_element_property_definition<T1>(
Expand All @@ -6607,6 +6607,7 @@ impl<'a> AstBuilder<'a> {
r#type: PropertyDefinitionType,
decorators: Vec<'a, Decorator<'a>>,
key: PropertyKey<'a>,
type_annotation: T1,
value: Option<Expression<'a>>,
computed: bool,
r#static: bool,
Expand All @@ -6615,7 +6616,6 @@ impl<'a> AstBuilder<'a> {
optional: bool,
definite: bool,
readonly: bool,
type_annotation: T1,
accessibility: Option<TSAccessibility>,
) -> ClassElement<'a>
where
Expand All @@ -6626,6 +6626,7 @@ impl<'a> AstBuilder<'a> {
r#type,
decorators,
key,
type_annotation,
value,
computed,
r#static,
Expand All @@ -6634,7 +6635,6 @@ impl<'a> AstBuilder<'a> {
optional,
definite,
readonly,
type_annotation,
accessibility,
))
}
Expand Down Expand Up @@ -6832,6 +6832,7 @@ impl<'a> AstBuilder<'a> {
/// * `type`
/// * `decorators`: Decorators applied to the property.
/// * `key`: The expression used to declare the property.
/// * `type_annotation`: Type annotation on the property.
/// * `value`: Initialized value in the declaration.
/// * `computed`: Property was declared with a computed key
/// * `static`: Property was declared with a `static` modifier
Expand All @@ -6840,7 +6841,6 @@ impl<'a> AstBuilder<'a> {
/// * `optional`: `true` when created with an optional modifier (`?`)
/// * `definite`
/// * `readonly`: `true` when declared with a `readonly` modifier
/// * `type_annotation`: Type annotation on the property.
/// * `accessibility`: Accessibility modifier.
#[inline]
pub fn property_definition<T1>(
Expand All @@ -6849,6 +6849,7 @@ impl<'a> AstBuilder<'a> {
r#type: PropertyDefinitionType,
decorators: Vec<'a, Decorator<'a>>,
key: PropertyKey<'a>,
type_annotation: T1,
value: Option<Expression<'a>>,
computed: bool,
r#static: bool,
Expand All @@ -6857,7 +6858,6 @@ impl<'a> AstBuilder<'a> {
optional: bool,
definite: bool,
readonly: bool,
type_annotation: T1,
accessibility: Option<TSAccessibility>,
) -> PropertyDefinition<'a>
where
Expand All @@ -6868,6 +6868,7 @@ impl<'a> AstBuilder<'a> {
r#type,
decorators,
key,
type_annotation: type_annotation.into_in(self.allocator),
value,
computed,
r#static,
Expand All @@ -6876,7 +6877,6 @@ impl<'a> AstBuilder<'a> {
optional,
definite,
readonly,
type_annotation: type_annotation.into_in(self.allocator),
accessibility,
}
}
Expand All @@ -6891,6 +6891,7 @@ impl<'a> AstBuilder<'a> {
/// * `type`
/// * `decorators`: Decorators applied to the property.
/// * `key`: The expression used to declare the property.
/// * `type_annotation`: Type annotation on the property.
/// * `value`: Initialized value in the declaration.
/// * `computed`: Property was declared with a computed key
/// * `static`: Property was declared with a `static` modifier
Expand All @@ -6899,7 +6900,6 @@ impl<'a> AstBuilder<'a> {
/// * `optional`: `true` when created with an optional modifier (`?`)
/// * `definite`
/// * `readonly`: `true` when declared with a `readonly` modifier
/// * `type_annotation`: Type annotation on the property.
/// * `accessibility`: Accessibility modifier.
#[inline]
pub fn alloc_property_definition<T1>(
Expand All @@ -6908,6 +6908,7 @@ impl<'a> AstBuilder<'a> {
r#type: PropertyDefinitionType,
decorators: Vec<'a, Decorator<'a>>,
key: PropertyKey<'a>,
type_annotation: T1,
value: Option<Expression<'a>>,
computed: bool,
r#static: bool,
Expand All @@ -6916,7 +6917,6 @@ impl<'a> AstBuilder<'a> {
optional: bool,
definite: bool,
readonly: bool,
type_annotation: T1,
accessibility: Option<TSAccessibility>,
) -> Box<'a, PropertyDefinition<'a>>
where
Expand All @@ -6928,6 +6928,7 @@ impl<'a> AstBuilder<'a> {
r#type,
decorators,
key,
type_annotation,
value,
computed,
r#static,
Expand All @@ -6936,7 +6937,6 @@ impl<'a> AstBuilder<'a> {
optional,
definite,
readonly,
type_annotation,
accessibility,
),
self.allocator,
Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_ast/src/generated/derive_clone_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3889,6 +3889,7 @@ impl<'new_alloc> CloneIn<'new_alloc> for PropertyDefinition<'_> {
r#type: CloneIn::clone_in(&self.r#type, allocator),
decorators: CloneIn::clone_in(&self.decorators, allocator),
key: CloneIn::clone_in(&self.key, allocator),
type_annotation: CloneIn::clone_in(&self.type_annotation, allocator),
value: CloneIn::clone_in(&self.value, allocator),
computed: CloneIn::clone_in(&self.computed, allocator),
r#static: CloneIn::clone_in(&self.r#static, allocator),
Expand All @@ -3897,7 +3898,6 @@ impl<'new_alloc> CloneIn<'new_alloc> for PropertyDefinition<'_> {
optional: CloneIn::clone_in(&self.optional, allocator),
definite: CloneIn::clone_in(&self.definite, allocator),
readonly: CloneIn::clone_in(&self.readonly, allocator),
type_annotation: CloneIn::clone_in(&self.type_annotation, allocator),
accessibility: CloneIn::clone_in(&self.accessibility, allocator),
}
}
Expand All @@ -3908,6 +3908,7 @@ impl<'new_alloc> CloneIn<'new_alloc> for PropertyDefinition<'_> {
r#type: CloneIn::clone_in_with_semantic_ids(&self.r#type, allocator),
decorators: CloneIn::clone_in_with_semantic_ids(&self.decorators, allocator),
key: CloneIn::clone_in_with_semantic_ids(&self.key, allocator),
type_annotation: CloneIn::clone_in_with_semantic_ids(&self.type_annotation, allocator),
value: CloneIn::clone_in_with_semantic_ids(&self.value, allocator),
computed: CloneIn::clone_in_with_semantic_ids(&self.computed, allocator),
r#static: CloneIn::clone_in_with_semantic_ids(&self.r#static, allocator),
Expand All @@ -3916,7 +3917,6 @@ impl<'new_alloc> CloneIn<'new_alloc> for PropertyDefinition<'_> {
optional: CloneIn::clone_in_with_semantic_ids(&self.optional, allocator),
definite: CloneIn::clone_in_with_semantic_ids(&self.definite, allocator),
readonly: CloneIn::clone_in_with_semantic_ids(&self.readonly, allocator),
type_annotation: CloneIn::clone_in_with_semantic_ids(&self.type_annotation, allocator),
accessibility: CloneIn::clone_in_with_semantic_ids(&self.accessibility, allocator),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/generated/derive_content_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,7 @@ impl ContentEq for PropertyDefinition<'_> {
ContentEq::content_eq(&self.r#type, &other.r#type)
&& ContentEq::content_eq(&self.decorators, &other.decorators)
&& ContentEq::content_eq(&self.key, &other.key)
&& ContentEq::content_eq(&self.type_annotation, &other.type_annotation)
&& ContentEq::content_eq(&self.value, &other.value)
&& ContentEq::content_eq(&self.computed, &other.computed)
&& ContentEq::content_eq(&self.r#static, &other.r#static)
Expand All @@ -1191,7 +1192,6 @@ impl ContentEq for PropertyDefinition<'_> {
&& ContentEq::content_eq(&self.optional, &other.optional)
&& ContentEq::content_eq(&self.definite, &other.definite)
&& ContentEq::content_eq(&self.readonly, &other.readonly)
&& ContentEq::content_eq(&self.type_annotation, &other.type_annotation)
&& ContentEq::content_eq(&self.accessibility, &other.accessibility)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_ast/src/generated/derive_dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ impl<'a> Dummy<'a> for PropertyDefinition<'a> {
r#type: Dummy::dummy(allocator),
decorators: Dummy::dummy(allocator),
key: Dummy::dummy(allocator),
type_annotation: Dummy::dummy(allocator),
value: Dummy::dummy(allocator),
computed: Dummy::dummy(allocator),
r#static: Dummy::dummy(allocator),
Expand All @@ -1256,7 +1257,6 @@ impl<'a> Dummy<'a> for PropertyDefinition<'a> {
optional: Dummy::dummy(allocator),
definite: Dummy::dummy(allocator),
readonly: Dummy::dummy(allocator),
type_annotation: Dummy::dummy(allocator),
accessibility: Dummy::dummy(allocator),
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_ast_visit/src/generated/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2598,12 +2598,12 @@ pub mod walk {
visitor.visit_span(&it.span);
visitor.visit_decorators(&it.decorators);
visitor.visit_property_key(&it.key);
if let Some(value) = &it.value {
visitor.visit_expression(value);
}
if let Some(type_annotation) = &it.type_annotation {
visitor.visit_ts_type_annotation(type_annotation);
}
if let Some(value) = &it.value {
visitor.visit_expression(value);
}
visitor.leave_node(kind);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_ast_visit/src/generated/visit_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2687,12 +2687,12 @@ pub mod walk_mut {
visitor.visit_span(&mut it.span);
visitor.visit_decorators(&mut it.decorators);
visitor.visit_property_key(&mut it.key);
if let Some(value) = &mut it.value {
visitor.visit_expression(value);
}
if let Some(type_annotation) = &mut it.type_annotation {
visitor.visit_ts_type_annotation(type_annotation);
}
if let Some(value) = &mut it.value {
visitor.visit_expression(value);
}
visitor.leave_node(kind);
}

Expand Down
Loading
Loading