refactor(transformer/arrow-function): reserve correct capacity for Vec (#7319)

This commit is contained in:
overlookmotel 2024-11-17 05:08:58 +00:00 committed by overlookmotel
parent e09d2df448
commit ea08c1f495

View file

@ -743,7 +743,8 @@ impl<'a> ArrowFunctionConverter<'a> {
let scope_id =
ctx.create_child_scope(target_scope_id, ScopeFlags::Arrow | ScopeFlags::Function);
let mut items = ctx.ast.vec_with_capacity(2);
let mut items =
ctx.ast.vec_with_capacity(usize::from(is_computed) + usize::from(is_assignment));
// Create a parameter for the prop if it's a computed member expression.
if is_computed {