refactor(ast): AstBuilder::move_identifier_reference do not allocate empty string (#4977)

#4920 introduced `AstBuilder::move_identifier_reference`. Make this slightly cheaper by using a static empty `Atom` rather than relying on `"".into_in(allocator)` which allocates an empty string into arena.
This commit is contained in:
overlookmotel 2024-08-19 11:48:38 +00:00
parent 64ace42566
commit 4012260c17

View file

@ -75,7 +75,7 @@ impl<'a> AstBuilder<'a> {
self,
expr: &mut IdentifierReference<'a>,
) -> IdentifierReference<'a> {
let dummy = self.identifier_reference(expr.span(), "");
let dummy = self.identifier_reference(expr.span(), Atom::empty());
mem::replace(expr, dummy)
}