Skip to content

Commit

Permalink
fix(oxc_ast, oxc_transformer): correct allocator parameter and argume…
Browse files Browse the repository at this point in the history
…nt positioning

- Updated `derive_clone_in.rs` to use the correct `allocator` parameter for consistency.
- Fixed argument positioning in function calls across `exponentiation_operator.rs` and `react/refresh.rs` to ensure proper parameter passing.
- These changes resolve potential runtime errors due to incorrect argument placement.
  • Loading branch information
cblh authored and Boshen committed Aug 18, 2024
1 parent b0a2f6c commit f7ce469
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions crates/oxc_ast/src/generated/derive_clone_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ impl<'old_alloc, 'new_alloc> CloneIn<'new_alloc> for CallExpression<'old_alloc>
type Cloned = CallExpression<'new_alloc>;
fn clone_in(&self, allocator: &'new_alloc Allocator) -> Self::Cloned {
CallExpression {
span: self.span.clone_in(alloc),
callee: self.callee.clone_in(alloc),
type_parameters: self.type_parameters.clone_in(alloc),
arguments: self.arguments.clone_in(alloc),
optional: self.optional.clone_in(alloc),
span: self.span.clone_in(allocator),
callee: self.callee.clone_in(allocator),
type_parameters: self.type_parameters.clone_in(allocator),
arguments: self.arguments.clone_in(allocator),
optional: self.optional.clone_in(allocator),
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ impl<'a> ExponentiationOperator<'a> {
arguments.push(Argument::from(right));
ctx.ast.expression_call(
SPAN,
arguments,
callee,
None::<TSTypeParameterInstantiation<'_>>,
arguments,
false,
)
}
Expand Down
12 changes: 6 additions & 6 deletions crates/oxc_transformer/src/react/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ impl<'a> ReactRefresh<'a> {
SPAN,
ctx.ast.expression_call(
SPAN,
ctx.ast.vec(),
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
Option::<TSTypeParameterInstantiation>::None,
ctx.ast.vec(),
false,
),
);
Expand All @@ -226,9 +226,9 @@ impl<'a> ReactRefresh<'a> {
),
Some(ctx.ast.expression_call(
SPAN,
ctx.ast.vec(),
ctx.ast.expression_from_identifier_reference(sig_identifier_reference.clone()),
Option::<TSTypeParameterInstantiation>::None,
ctx.ast.vec(),
false,
)),
false,
Expand Down Expand Up @@ -439,9 +439,9 @@ impl<'a> ReactRefresh<'a> {
SPAN,
ctx.ast.expression_call(
SPAN,
arguments,
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
Option::<TSTypeParameterInstantiation>::None,
arguments,
false,
),
))
Expand Down Expand Up @@ -509,12 +509,12 @@ impl<'a> ReactRefresh<'a> {
SPAN,
ctx.ast.expression_call(
SPAN,
arguments,
Self::create_identifier_reference_from_binding_identifier(
&binding_identifier,
ctx,
),
Option::<TSTypeParameterInstantiation>::None,
arguments,
false,
),
))
Expand Down Expand Up @@ -626,9 +626,9 @@ impl<'a> ReactRefresh<'a> {
SPAN,
ctx.ast.expression_call(
SPAN,
arguments,
callee,
Option::<TSTypeParameterInstantiation>::None,
arguments,
false,
),
));
Expand Down Expand Up @@ -800,9 +800,9 @@ impl<'a> ReactRefresh<'a> {
arguments.insert(0, Argument::from(ctx.ast.move_expression(expr)));
*expr = self.ctx.ast.expression_call(
SPAN,
arguments,
Self::create_identifier_reference_from_binding_identifier(&binding_identifier, ctx),
Option::<TSTypeParameterInstantiation>::None,
arguments,
false,
);
}
Expand Down

0 comments on commit f7ce469

Please sign in to comment.