Skip to content

Commit

Permalink
feat(traverse): expose generate_uid_based_on_node and generate_uid_in…
Browse files Browse the repository at this point in the history
…_current_scope_based_on_node from TraverseCtx
  • Loading branch information
Dunqing committed Aug 19, 2024
1 parent 6800e69 commit 1b2babf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/oxc_traverse/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,29 @@ impl<'a> TraverseCtx<'a> {
self.scoping.generate_uid_in_root_scope(name, flags)
}

/// Generate UID based on node.
///
/// This is a shortcut for `ctx.scoping.generate_uid_based_on_node`.
pub fn generate_uid_based_on_node(
&mut self,
node: &Expression<'a>,
scope_id: ScopeId,
flags: SymbolFlags,
) -> SymbolId {
self.scoping.generate_uid_based_on_node(node, scope_id, flags)
}

/// Generate UID in current scope based on node.
///
/// This is a shortcut for `ctx.scoping.generate_uid_in_current_scope_based_on_node`.
pub fn generate_uid_in_current_scope_based_on_node(
&mut self,
node: &Expression<'a>,
flags: SymbolFlags,
) -> SymbolId {
self.scoping.generate_uid_in_current_scope_based_on_node(node, flags)
}

/// Create a reference bound to a `SymbolId`.
///
/// This is a shortcut for `ctx.scoping.create_bound_reference`.
Expand Down

0 comments on commit 1b2babf

Please sign in to comment.