Skip to content

Commit 6b885fe

Browse files
committed
feat(traverse): expose generate_uid_based_on_node and generate_uid_in_current_scope_based_on_node from TraverseCtx (#4965)
Both of these APIs were added in #4940. But they weren't exposed.
1 parent 7706523 commit 6b885fe

File tree

1 file changed

+23
-0
lines changed
  • crates/oxc_traverse/src/context

1 file changed

+23
-0
lines changed

crates/oxc_traverse/src/context/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,29 @@ impl<'a> TraverseCtx<'a> {
291291
self.scoping.generate_uid_in_root_scope(name, flags)
292292
}
293293

294+
/// Generate UID based on node.
295+
///
296+
/// This is a shortcut for `ctx.scoping.generate_uid_based_on_node`.
297+
pub fn generate_uid_based_on_node(
298+
&mut self,
299+
node: &Expression<'a>,
300+
scope_id: ScopeId,
301+
flags: SymbolFlags,
302+
) -> SymbolId {
303+
self.scoping.generate_uid_based_on_node(node, scope_id, flags)
304+
}
305+
306+
/// Generate UID in current scope based on node.
307+
///
308+
/// This is a shortcut for `ctx.scoping.generate_uid_in_current_scope_based_on_node`.
309+
pub fn generate_uid_in_current_scope_based_on_node(
310+
&mut self,
311+
node: &Expression<'a>,
312+
flags: SymbolFlags,
313+
) -> SymbolId {
314+
self.scoping.generate_uid_in_current_scope_based_on_node(node, flags)
315+
}
316+
294317
/// Create a reference bound to a `SymbolId`.
295318
///
296319
/// This is a shortcut for `ctx.scoping.create_bound_reference`.

0 commit comments

Comments
 (0)