mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/react-refresh): use generate_uid_in_current_hoist_scope to add hoisted binding (#7492)
This commit is contained in:
parent
488029ea24
commit
ef62b9dacc
1 changed files with 1 additions and 8 deletions
|
|
@ -582,14 +582,7 @@ impl<'a, 'ctx> ReactRefresh<'a, 'ctx> {
|
|||
arguments.push(function);
|
||||
}
|
||||
|
||||
// TODO: Handle var hoisted in ctx API
|
||||
let target_scope_id = ctx
|
||||
.scopes()
|
||||
.ancestors(ctx.current_scope_id())
|
||||
.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);
|
||||
let binding = ctx.generate_uid_in_current_hoist_scope("s");
|
||||
|
||||
// _s();
|
||||
let call_expression = ctx.ast.statement_expression(
|
||||
|
|
|
|||
Loading…
Reference in a new issue