Skip to content

Commit 6667820

Browse files
committed
fix codegen, prettier, transformer
1 parent 7d33c5c commit 6667820

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

crates/oxc_codegen/src/gen.rs

+3-3
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 */);`

crates/oxc_prettier/src/format/print/call_arguments.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ pub fn print_import_source_and_arguments<'a>(
237237
let mut indent_parts = Vec::new_in(p.allocator);
238238
indent_parts.push(softline!());
239239
indent_parts.push(expr.source.format(p));
240-
if !expr.arguments.is_empty() {
241-
for arg in &expr.arguments {
240+
if !expr.options.is_empty() {
241+
for arg in &expr.options {
242242
indent_parts.push(text!(","));
243243
indent_parts.push(line!());
244244
indent_parts.push(arg.format(p));
@@ -301,7 +301,7 @@ fn is_hopefully_short_call_argument(mut node: &Expression) -> bool {
301301
return !match node {
302302
Expression::CallExpression(call) => call.arguments.len() > 1,
303303
Expression::NewExpression(call) => call.arguments.len() > 1,
304-
Expression::ImportExpression(call) => call.arguments.len() > 0,
304+
Expression::ImportExpression(call) => call.options.len() > 0,
305305
_ => false,
306306
};
307307
}
@@ -350,7 +350,7 @@ fn is_simple_call_argument(node: &Expression, depth: usize) -> bool {
350350

351351
if node.is_call_expression() {
352352
if let Expression::ImportExpression(expr) = node {
353-
return expr.arguments.len() <= depth && expr.arguments.iter().all(is_child_simple);
353+
return expr.options.len() <= depth && expr.options.iter().all(is_child_simple);
354354
} else if let Expression::CallExpression(expr) = node {
355355
if is_simple_call_argument(&expr.callee, depth) {
356356
return expr.arguments.len() <= depth

crates/oxc_transformer/src/plugins/module_runner_transform.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ impl<'a> ModuleRunnerTransform<'a> {
255255
unreachable!();
256256
};
257257

258-
let ImportExpression { span, source, arguments, .. } = import_expr.unbox();
258+
let ImportExpression { span, source, options, .. } = import_expr.unbox();
259259

260260
if let Expression::StringLiteral(source) = &source {
261261
self.dynamic_deps.push(source.value.to_string());
262262
}
263263

264264
let flags = ReferenceFlags::Read;
265265
let callee = ctx.create_unbound_ident_expr(SPAN, SSR_DYNAMIC_IMPORT_KEY, flags);
266-
let arguments = arguments.into_iter().map(Argument::from);
266+
let arguments = options.into_iter().map(Argument::from);
267267
let arguments = ctx.ast.vec_from_iter(iter::once(Argument::from(source)).chain(arguments));
268268
*expr = ctx.ast.expression_call(span, callee, NONE, arguments, false);
269269
}

0 commit comments

Comments
 (0)