Skip to content

Commit

Permalink
feat(traverse): add BoundIdentifier::from_binding_ident method
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Oct 23, 2024
1 parent 871b9f5 commit 5fcc226
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/oxc_traverse/src/context/bound_identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ impl<'a> BoundIdentifier<'a> {
Self { name, symbol_id }
}

/// Create `BoundIdentifier` from a `BindingIdentifier`
pub fn from_binding_ident(ident: &BindingIdentifier<'a>) -> Self {
Self { name: ident.name.clone(), symbol_id: ident.symbol_id.get().unwrap() }
}

/// Create `BindingIdentifier` for this binding
pub fn create_binding_identifier(&self, ctx: &TraverseCtx<'a>) -> BindingIdentifier<'a> {
ctx.ast.binding_identifier_with_symbol_id(SPAN, self.name.clone(), self.symbol_id)
Expand Down

0 comments on commit 5fcc226

Please sign in to comment.