refactor(isolated_declarations): do not copy Vec unnecessarily (#7332)

This function receives an owned `oxc_allocator::Vec`. No need to copy the contents to a new `Vec` with `AstBuilder::vec_from_iter`, can just use the original.
This commit is contained in:
overlookmotel 2024-11-18 02:28:38 +00:00
parent 44fd962fbb
commit 1938a1d6d9

View file

@ -41,12 +41,7 @@ impl<'a> IsolatedDeclarations<'a> {
decl: &VariableDeclaration<'a>,
declarations: oxc_allocator::Vec<'a, VariableDeclarator<'a>>,
) -> Box<'a, VariableDeclaration<'a>> {
self.ast.alloc_variable_declaration(
decl.span,
decl.kind,
self.ast.vec_from_iter(declarations),
self.is_declare(),
)
self.ast.alloc_variable_declaration(decl.span, decl.kind, declarations, self.is_declare())
}
pub(crate) fn transform_variable_declarator(