mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(traverse): add TraverseCtx::generate_uid_in_current_hoist_scope_based_on_node (#7642)
We have a lot of usage for this API in `class-properties`
This commit is contained in:
parent
3de4a43761
commit
ff73c7ffde
1 changed files with 13 additions and 0 deletions
|
|
@ -427,6 +427,19 @@ impl<'a> TraverseCtx<'a> {
|
|||
self.generate_uid(name, self.current_hoist_scope_id(), SymbolFlags::FunctionScopedVariable)
|
||||
}
|
||||
|
||||
/// Generate UID in current hoist scope based on node.
|
||||
///
|
||||
/// See also comments on [`TraverseScoping::generate_uid_name`] for important information
|
||||
/// on how UIDs are generated. There are some potential "gotchas".
|
||||
#[inline]
|
||||
pub fn generate_uid_in_current_hoist_scope_based_on_node<N: GatherNodeParts<'a>>(
|
||||
&mut self,
|
||||
node: &N,
|
||||
) -> BoundIdentifier<'a> {
|
||||
let name = get_var_name_from_node(node);
|
||||
self.generate_uid_in_current_hoist_scope(&name)
|
||||
}
|
||||
|
||||
/// Create a reference bound to a `SymbolId`.
|
||||
///
|
||||
/// This is a shortcut for `ctx.scoping.create_bound_reference`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue