use oxc_allocator::Allocator;
use oxc_semantic::{ScopeTree, SymbolTable};
use super::TraverseCtx;
#[repr(transparent)]
pub struct ReusableTraverseCtx<'a>(TraverseCtx<'a>);
impl<'a> ReusableTraverseCtx<'a> {
pub fn new(scopes: ScopeTree, symbols: SymbolTable, allocator: &'a Allocator) -> Self {
Self(TraverseCtx::new(scopes, symbols, allocator))
}
pub fn into_symbol_table_and_scope_tree(self) -> (SymbolTable, ScopeTree) {
self.0.scoping.into_symbol_table_and_scope_tree()
}
#[inline]
#[expect(clippy::missing_safety_doc)]
pub unsafe fn unwrap(self) -> TraverseCtx<'a> {
self.0
}
}
impl<'a> ReusableTraverseCtx<'a> {
#[inline] pub(crate) fn get_mut(&mut self) -> &mut TraverseCtx<'a> {
&mut self.0
}
}