mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(ast): reduce allocations in AstBuilder::move_assignment_target (#5367)
`AstBuilder::move_assignment_target` pass a static `Atom` instead of empty string to `AstBuilder::simple_assignment_target_identifier_reference`. This avoids a call to `alloc` to allocate an empty string in arena.
This commit is contained in:
parent
1d9fd1fdcc
commit
c2d8c9e743
1 changed files with 2 additions and 1 deletions
|
|
@ -84,7 +84,8 @@ impl<'a> AstBuilder<'a> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn move_assignment_target(self, target: &mut AssignmentTarget<'a>) -> AssignmentTarget<'a> {
|
pub fn move_assignment_target(self, target: &mut AssignmentTarget<'a>) -> AssignmentTarget<'a> {
|
||||||
let dummy = self.simple_assignment_target_identifier_reference(Span::default(), "");
|
let dummy =
|
||||||
|
self.simple_assignment_target_identifier_reference(Span::default(), Atom::from(""));
|
||||||
mem::replace(target, dummy.into())
|
mem::replace(target, dummy.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue