mirror of
https://github.com/danbulant/oxc
synced 2026-05-21 13:18:59 +00:00
refactor(ast): rename #[estree(with)] to #[estree(via)] (#8564)
Follow-on after #8560. Rename `#[estree(with)]` attr introduced in #8560 for struct fields to `#[estree(via)]`. This is to match the attr which does the same thing on struct itself. e.g.:
869bc73e67/crates/oxc_ast/src/ast/literal.rs (L23-L29)
This commit is contained in:
parent
4d4e805691
commit
fcbca322d7
3 changed files with 7 additions and 7 deletions
|
|
@ -2196,7 +2196,7 @@ pub struct ImportExpression<'a> {
|
||||||
pub struct ImportDeclaration<'a> {
|
pub struct ImportDeclaration<'a> {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// `None` for `import 'foo'`, `Some([])` for `import {} from 'foo'`
|
/// `None` for `import 'foo'`, `Some([])` for `import {} from 'foo'`
|
||||||
#[estree(with = "OptionVecDefault", type = "Array<ImportDeclarationSpecifier>")]
|
#[estree(via = "OptionVecDefault", type = "Array<ImportDeclarationSpecifier>")]
|
||||||
pub specifiers: Option<Vec<'a, ImportDeclarationSpecifier<'a>>>,
|
pub specifiers: Option<Vec<'a, ImportDeclarationSpecifier<'a>>>,
|
||||||
pub source: StringLiteral<'a>,
|
pub source: StringLiteral<'a>,
|
||||||
pub phase: Option<ImportPhase>,
|
pub phase: Option<ImportPhase>,
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ fn serialize_struct(def: &StructDef, schema: &Schema) -> TokenStream {
|
||||||
}
|
}
|
||||||
)?;
|
)?;
|
||||||
});
|
});
|
||||||
} else if let Some(with) = &field.markers.derive_attributes.estree.with {
|
} else if let Some(with) = &field.markers.derive_attributes.estree.via {
|
||||||
let with_ident = with.to_ident();
|
let with_ident = with.to_ident();
|
||||||
fields.push(quote! {
|
fields.push(quote! {
|
||||||
map.serialize_entry(
|
map.serialize_entry(
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ pub struct ESTreeFieldAttribute {
|
||||||
pub rename: Option<String>,
|
pub rename: Option<String>,
|
||||||
pub typescript_type: Option<String>,
|
pub typescript_type: Option<String>,
|
||||||
pub append_to: Option<String>,
|
pub append_to: Option<String>,
|
||||||
pub with: Option<String>,
|
pub via: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for ESTreeFieldAttribute {
|
impl Parse for ESTreeFieldAttribute {
|
||||||
|
|
@ -237,7 +237,7 @@ impl Parse for ESTreeFieldAttribute {
|
||||||
let mut rename = None;
|
let mut rename = None;
|
||||||
let mut typescript_type = None;
|
let mut typescript_type = None;
|
||||||
let mut append_to = None;
|
let mut append_to = None;
|
||||||
let mut with = None;
|
let mut via = None;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let is_type = input.peek(Token![type]);
|
let is_type = input.peek(Token![type]);
|
||||||
|
|
@ -283,10 +283,10 @@ impl Parse for ESTreeFieldAttribute {
|
||||||
"Duplicate estree(append_to)"
|
"Duplicate estree(append_to)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
"with" => {
|
"via" => {
|
||||||
input.parse::<Token![=]>()?;
|
input.parse::<Token![=]>()?;
|
||||||
assert!(
|
assert!(
|
||||||
with.replace(input.parse::<LitStr>()?.value()).is_none(),
|
via.replace(input.parse::<LitStr>()?.value()).is_none(),
|
||||||
"Duplicate estree(with)"
|
"Duplicate estree(with)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +299,7 @@ impl Parse for ESTreeFieldAttribute {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(Self { flatten, skip, rename, typescript_type, append_to, with })
|
Ok(Self { flatten, skip, rename, typescript_type, append_to, via })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue