mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(traverse): add BoundIdentifier::from_binding_ident method (#6814)
This commit is contained in:
parent
b8dfa191be
commit
ce1d8cf20b
1 changed files with 6 additions and 0 deletions
|
|
@ -46,6 +46,12 @@ impl<'a> BoundIdentifier<'a> {
|
|||
Self { name, symbol_id }
|
||||
}
|
||||
|
||||
/// Create `BoundIdentifier` from a `BindingIdentifier`
|
||||
#[expect(clippy::missing_panics_doc)]
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue