mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/react-refresh): dereference ScopeId as soon as possible (#6820)
Style nit. Dereference `&ScopeId` to `ScopeId` as early as possible. `&ScopeId` is 8 bytes, whereas `ScopeId` is 4 bytes. In simple cases like this, compiler will optimize it anyway, but still I think it's a better pattern to dererence early. In more complicated cases, it will be better for performance, and in my opinion, it makes things clearer if vars called `scope_id` are always a `ScopeId`, not sometimes a `&ScopeId`.
This commit is contained in:
parent
57685b28e8
commit
e5f4b4a333
1 changed files with 1 additions and 1 deletions
|
|
@ -646,7 +646,7 @@ impl<'a, 'ctx> ReactRefresh<'a, 'ctx> {
|
|||
let target_scope_id = ctx
|
||||
.scopes()
|
||||
.ancestors(ctx.current_scope_id())
|
||||
.find(|scope_id| ctx.scopes().get_flags(*scope_id).is_var())
|
||||
.find(|&scope_id| ctx.scopes().get_flags(scope_id).is_var())
|
||||
.unwrap_or_else(|| ctx.current_scope_id());
|
||||
|
||||
let binding = ctx.generate_uid("s", target_scope_id, SymbolFlags::FunctionScopedVariable);
|
||||
|
|
|
|||
Loading…
Reference in a new issue