use oxc_allocator::Allocator;
use oxc_semantic::Scoping;
use super::TraverseCtx;
#[repr(transparent)]
pub struct ReusableTraverseCtx<'a, State>(TraverseCtx<'a, State>);
impl<'a, State> ReusableTraverseCtx<'a, State> {
pub fn new(state: State, scoping: Scoping, allocator: &'a Allocator) -> Self {
Self(TraverseCtx::new(state, scoping, allocator))
}
pub fn into_scoping(self) -> Scoping {
self.0.scoping.into_scoping()
}
#[inline]
pub unsafe fn unwrap(self) -> TraverseCtx<'a, State> {
self.0
}
}
impl<'a, State> ReusableTraverseCtx<'a, State> {
#[inline] pub(crate) fn get_mut(&mut self) -> &mut TraverseCtx<'a, State> {
&mut self.0
}
}