From ed2e515f8083ad1823379ac661794bd952cc9091 Mon Sep 17 00:00:00 2001 From: overlookmotel <557937+overlookmotel@users.noreply.github.com> Date: Sun, 17 Nov 2024 05:08:58 +0000 Subject: [PATCH] refactor(transformer/arrow-function): reserve correct capacity for `Vec` (#7319) --- crates/oxc_transformer/src/common/arrow_function_converter.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/oxc_transformer/src/common/arrow_function_converter.rs b/crates/oxc_transformer/src/common/arrow_function_converter.rs index 0499dd11ecd644..823710e7b3ca46 100644 --- a/crates/oxc_transformer/src/common/arrow_function_converter.rs +++ b/crates/oxc_transformer/src/common/arrow_function_converter.rs @@ -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 {