Skip to content

Commit

Permalink
refactor(transformer/react-refresh): use `generate_uid_in_current_hoi…
Browse files Browse the repository at this point in the history
…st_scope` to add hoisted binding (#7492)
  • Loading branch information
Dunqing committed Nov 26, 2024
1 parent 488029e commit ef62b9d
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions crates/oxc_transformer/src/jsx/refresh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ef62b9d

Please sign in to comment.