use oxc_allocator::Allocator;
use oxc_semantic::Scoping;
use super::TraverseCtx;
#[repr(transparent)]
pub struct ReusableTraverseCtx<'a>(TraverseCtx<'a>);
impl<'a> ReusableTraverseCtx<'a> {
pub fn new(scoping: Scoping, allocator: &'a Allocator) -> Self {
Self(TraverseCtx::new(scoping, allocator))
}
pub fn into_scoping(self) -> Scoping {
self.0.scoping.into_scoping()
}
#[inline]
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
}
}