Skip to content

Commit

Permalink
refactor(transformer/class-properties): re-use existing Vec
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Dec 13, 2024
1 parent f8175c5 commit 85641d8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/oxc_transformer/src/es2022/class_properties/supers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
arguments: &mut ArenaVec<'a, Argument<'a>>,
ctx: &mut TraverseCtx<'a>,
) {
let owned_arguments = ctx.ast.move_vec(arguments);
let elements =
ctx.ast.vec_from_iter(owned_arguments.into_iter().map(ArrayExpressionElement::from));
let elements = arguments.drain(..).map(ArrayExpressionElement::from);
let elements = ctx.ast.vec_from_iter(elements);
let array = ctx.ast.expression_array(SPAN, elements, None);
arguments.push(Argument::from(array));
}
Expand Down

0 comments on commit 85641d8

Please sign in to comment.