refactor(ast): make AstBuilder Copy (#3602)

`AstBuilder` only contains a shared ref `&Allocator`. So make it `Copy` and pass around `AstBuilder<'a>` instead of `&AstBuilder<'a>` - 1 less level of indirection.

Hopefully this will have little effect on benchmarks as all `AstBuilder`'s methods are marked `#[inline]`, but this change will minimize impact if compiler decides not to inline for some reason.
This commit is contained in:
overlookmotel 2024-06-10 11:17:43 +00:00
parent d6370f19fe
commit 08f1010dca
3 changed files with 218 additions and 236 deletions

File diff suppressed because it is too large Load diff

View file

@ -412,8 +412,8 @@ impl<'a> ReactJsx<'a> {
self.ctx.source_type.is_script()
}
fn ast(&self) -> &AstBuilder<'a> {
&self.ctx.ast
fn ast(&self) -> AstBuilder<'a> {
self.ctx.ast
}
}

View file

@ -63,7 +63,7 @@ impl<'a> TypeScriptAnnotations<'a> {
// Creates `this.name = name`
fn create_this_property_assignment(&self, name: &Atom<'a>) -> Statement<'a> {
let ast = &self.ctx.ast;
let ast = self.ctx.ast;
ast.expression_statement(
SPAN,