Skip to content

Commit 475b48f

Browse files
committed
1 parent a7b6b60 commit 475b48f

File tree

16 files changed

+52
-54
lines changed

16 files changed

+52
-54
lines changed

crates/oxc_ast/src/ast/js.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,8 +2313,8 @@ pub struct AccessorProperty<'a> {
23132313
pub struct ImportExpression<'a> {
23142314
pub span: Span,
23152315
pub source: Expression<'a>,
2316-
#[estree(rename = "options", via = ImportExpressionArguments)]
2317-
pub arguments: Vec<'a, Expression<'a>>,
2316+
#[estree(via = ImportExpressionOptions)]
2317+
pub options: Vec<'a, Expression<'a>>,
23182318
#[estree(skip)]
23192319
pub phase: Option<ImportPhase>,
23202320
}

crates/oxc_ast/src/generated/assert_layouts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ const _: () = {
663663
assert!(align_of::<ImportExpression>() == 8);
664664
assert!(offset_of!(ImportExpression, span) == 0);
665665
assert!(offset_of!(ImportExpression, source) == 8);
666-
assert!(offset_of!(ImportExpression, arguments) == 24);
666+
assert!(offset_of!(ImportExpression, options) == 24);
667667
assert!(offset_of!(ImportExpression, phase) == 56);
668668

669669
assert!(size_of::<ImportDeclaration>() == 104);
@@ -2067,7 +2067,7 @@ const _: () = {
20672067
assert!(align_of::<ImportExpression>() == 4);
20682068
assert!(offset_of!(ImportExpression, span) == 0);
20692069
assert!(offset_of!(ImportExpression, source) == 8);
2070-
assert!(offset_of!(ImportExpression, arguments) == 16);
2070+
assert!(offset_of!(ImportExpression, options) == 16);
20712071
assert!(offset_of!(ImportExpression, phase) == 32);
20722072

20732073
assert!(size_of::<ImportDeclaration>() == 60);

crates/oxc_ast/src/generated/ast_builder.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -846,17 +846,17 @@ impl<'a> AstBuilder<'a> {
846846
/// ## Parameters
847847
/// * `span`: The [`Span`] covering this node
848848
/// * `source`
849-
/// * `arguments`
849+
/// * `options`
850850
/// * `phase`
851851
#[inline]
852852
pub fn expression_import(
853853
self,
854854
span: Span,
855855
source: Expression<'a>,
856-
arguments: Vec<'a, Expression<'a>>,
856+
options: Vec<'a, Expression<'a>>,
857857
phase: Option<ImportPhase>,
858858
) -> Expression<'a> {
859-
Expression::ImportExpression(self.alloc_import_expression(span, source, arguments, phase))
859+
Expression::ImportExpression(self.alloc_import_expression(span, source, options, phase))
860860
}
861861

862862
/// Build an [`Expression::LogicalExpression`].
@@ -7461,17 +7461,17 @@ impl<'a> AstBuilder<'a> {
74617461
/// ## Parameters
74627462
/// * `span`: The [`Span`] covering this node
74637463
/// * `source`
7464-
/// * `arguments`
7464+
/// * `options`
74657465
/// * `phase`
74667466
#[inline]
74677467
pub fn import_expression(
74687468
self,
74697469
span: Span,
74707470
source: Expression<'a>,
7471-
arguments: Vec<'a, Expression<'a>>,
7471+
options: Vec<'a, Expression<'a>>,
74727472
phase: Option<ImportPhase>,
74737473
) -> ImportExpression<'a> {
7474-
ImportExpression { span, source, arguments, phase }
7474+
ImportExpression { span, source, options, phase }
74757475
}
74767476

74777477
/// Build an [`ImportExpression`], and store it in the memory arena.
@@ -7481,17 +7481,17 @@ impl<'a> AstBuilder<'a> {
74817481
/// ## Parameters
74827482
/// * `span`: The [`Span`] covering this node
74837483
/// * `source`
7484-
/// * `arguments`
7484+
/// * `options`
74857485
/// * `phase`
74867486
#[inline]
74877487
pub fn alloc_import_expression(
74887488
self,
74897489
span: Span,
74907490
source: Expression<'a>,
7491-
arguments: Vec<'a, Expression<'a>>,
7491+
options: Vec<'a, Expression<'a>>,
74927492
phase: Option<ImportPhase>,
74937493
) -> Box<'a, ImportExpression<'a>> {
7494-
Box::new_in(self.import_expression(span, source, arguments, phase), self.allocator)
7494+
Box::new_in(self.import_expression(span, source, options, phase), self.allocator)
74957495
}
74967496

74977497
/// Build an [`ImportDeclaration`].

crates/oxc_ast/src/generated/derive_clone_in.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ impl<'new_alloc> CloneIn<'new_alloc> for ImportExpression<'_> {
21422142
ImportExpression {
21432143
span: CloneIn::clone_in(&self.span, allocator),
21442144
source: CloneIn::clone_in(&self.source, allocator),
2145-
arguments: CloneIn::clone_in(&self.arguments, allocator),
2145+
options: CloneIn::clone_in(&self.options, allocator),
21462146
phase: CloneIn::clone_in(&self.phase, allocator),
21472147
}
21482148
}

crates/oxc_ast/src/generated/derive_content_eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ impl ContentEq for AccessorProperty<'_> {
12601260
impl ContentEq for ImportExpression<'_> {
12611261
fn content_eq(&self, other: &Self) -> bool {
12621262
ContentEq::content_eq(&self.source, &other.source)
1263-
&& ContentEq::content_eq(&self.arguments, &other.arguments)
1263+
&& ContentEq::content_eq(&self.options, &other.options)
12641264
&& ContentEq::content_eq(&self.phase, &other.phase)
12651265
}
12661266
}

crates/oxc_ast/src/generated/derive_estree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ impl ESTree for ImportExpression<'_> {
16341634
state.serialize_field("start", &self.span.start);
16351635
state.serialize_field("end", &self.span.end);
16361636
state.serialize_field("source", &self.source);
1637-
state.serialize_field("options", &crate::serialize::ImportExpressionArguments(self));
1637+
state.serialize_field("options", &crate::serialize::ImportExpressionOptions(self));
16381638
state.end();
16391639
}
16401640
}

crates/oxc_ast/src/serialize.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,23 +414,22 @@ impl ESTree for AssignmentTargetPropertyIdentifierValue<'_> {
414414
}
415415
}
416416

417-
/// Serializer for `arguments` field of `ImportExpression`
418-
/// (which is renamed to `options` in ESTree AST).
417+
/// Serializer for `options` field of `ImportExpression`.
419418
///
420-
/// Serialize only the first expression in `arguments`, or `null` if `arguments` is empty.
419+
/// Serialize only the first expression in `options`, or `null` if `options` is empty.
421420
#[ast_meta]
422421
#[estree(
423422
ts_type = "Expression | null",
424423
raw_deser = "
425-
const args = DESER[Vec<Expression>](POS_OFFSET.arguments);
426-
args.length === 0 ? null : args[0]
424+
const options = DESER[Vec<Expression>](POS_OFFSET.options);
425+
options.length === 0 ? null : options[0]
427426
"
428427
)]
429-
pub struct ImportExpressionArguments<'a>(pub &'a ImportExpression<'a>);
428+
pub struct ImportExpressionOptions<'a>(pub &'a ImportExpression<'a>);
430429

431-
impl ESTree for ImportExpressionArguments<'_> {
430+
impl ESTree for ImportExpressionOptions<'_> {
432431
fn serialize<S: Serializer>(&self, serializer: S) {
433-
if let Some(expression) = self.0.arguments.first() {
432+
if let Some(expression) = self.0.options.first() {
434433
expression.serialize(serializer);
435434
} else {
436435
().serialize(serializer);

crates/oxc_ast_visit/src/generated/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2692,7 +2692,7 @@ pub mod walk {
26922692
visitor.enter_node(kind);
26932693
visitor.visit_span(&it.span);
26942694
visitor.visit_expression(&it.source);
2695-
visitor.visit_expressions(&it.arguments);
2695+
visitor.visit_expressions(&it.options);
26962696
visitor.leave_node(kind);
26972697
}
26982698

crates/oxc_ast_visit/src/generated/visit_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ pub mod walk_mut {
27932793
visitor.enter_node(kind);
27942794
visitor.visit_span(&mut it.span);
27952795
visitor.visit_expression(&mut it.source);
2796-
visitor.visit_expressions(&mut it.arguments);
2796+
visitor.visit_expressions(&mut it.options);
27972797
visitor.leave_node(kind);
27982798
}
27992799

crates/oxc_codegen/src/gen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,7 @@ impl GenExpr for ImportExpression<'_> {
20862086
&& (has_comment_before_right_paren
20872087
|| p.has_comment(self.source.span().start)
20882088
|| self
2089-
.arguments
2089+
.options
20902090
.first()
20912091
.is_some_and(|argument| p.has_comment(argument.span().start)));
20922092

@@ -2108,15 +2108,15 @@ impl GenExpr for ImportExpression<'_> {
21082108
p.print_indent();
21092109
}
21102110
self.source.print_expr(p, Precedence::Comma, Context::empty());
2111-
if !self.arguments.is_empty() {
2111+
if !self.options.is_empty() {
21122112
p.print_comma();
21132113
if has_comment {
21142114
p.print_soft_newline();
21152115
p.print_indent();
21162116
} else {
21172117
p.print_soft_space();
21182118
}
2119-
p.print_expressions(&self.arguments, Precedence::Comma, Context::empty());
2119+
p.print_expressions(&self.options, Precedence::Comma, Context::empty());
21202120
}
21212121
if has_comment {
21222122
// Handle `/* comment */);`

0 commit comments

Comments
 (0)