Skip to content

Commit 8c6d877

Browse files
committed
refactor(ast): rename #[estree(always_flatten)] attr to #[estree(flatten)]
1 parent 92fcb66 commit 8c6d877

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

crates/oxc_span/src/span/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use super::PointerAlign;
6161
#[ast(visit)]
6262
#[derive(Default, Clone, Copy, Eq, PartialOrd, Ord)]
6363
#[generate_derive(ESTree)]
64-
#[estree(no_type, always_flatten)]
64+
#[estree(no_type, flatten)]
6565
pub struct Span {
6666
/// The zero-based start offset of the span
6767
pub start: u32,

tasks/ast_tools/src/derives/estree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn parse_estree_attr(location: AttrLocation, part: AttrPart) -> Result<()> {
8484
match location {
8585
// `#[estree]` attr on struct
8686
AttrLocation::Struct(struct_def) => match part {
87-
AttrPart::Tag("always_flatten") => struct_def.estree.always_flatten = true,
87+
AttrPart::Tag("flatten") => struct_def.estree.flatten = true,
8888
AttrPart::Tag("no_type") => struct_def.estree.no_type = true,
8989
AttrPart::Tag("custom_serialize") => struct_def.estree.custom_serialize = true,
9090
AttrPart::String("rename", value) => struct_def.estree.rename = Some(value),
@@ -266,15 +266,15 @@ pub fn should_add_type_field_to_struct(struct_def: &StructDef) -> bool {
266266
/// Get if should flatten a struct field.
267267
///
268268
/// Returns `true` if either the field has an `#[estree(flatten)]` attr on it,
269-
/// or the type that the field contains has an `#[estree(always_flatten)]` attr.
269+
/// or the type that the field contains has an `#[estree(flatten)]` attr.
270270
///
271271
/// This function also used by Typescript generator.
272272
pub fn should_flatten_field(field: &FieldDef, schema: &Schema) -> bool {
273273
if field.estree.flatten {
274274
true
275275
} else {
276276
let field_type = field.type_def(schema);
277-
matches!(field_type, TypeDef::Struct(field_struct_def) if field_struct_def.estree.always_flatten)
277+
matches!(field_type, TypeDef::Struct(field_struct_def) if field_struct_def.estree.flatten)
278278
}
279279
}
280280

tasks/ast_tools/src/schema/extensions/estree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub struct ESTreeStruct {
44
pub rename: Option<String>,
55
pub via: Option<String>,
66
pub add_ts: Option<String>,
7-
pub always_flatten: bool,
7+
pub flatten: bool,
88
pub no_type: bool,
99
pub custom_serialize: bool,
1010
}

0 commit comments

Comments
 (0)