1use crate::span::Span;
2use bumpalo::Bump;
3use core::cell::RefCell;
4use std::collections::HashSet;
5
6pub type Allocator<'a> = &'a Bump;
8
9#[derive(Debug, Default)]
11pub struct Context<'a> {
12    allocator: Bump,
13    spans: RefCell<HashSet<Span<'a>>>,
14}
15
16impl<'a> Context<'a> {
17    pub fn new() -> Self {
19        Self {
20            allocator: Bump::new(),
21            spans: Default::default(),
22        }
23    }
24
25    pub const fn allocator(&self) -> &Bump {
27        &self.allocator
28    }
29
30    pub(crate) const fn spans(&self) -> &RefCell<HashSet<Span<'a>>> {
31        &self.spans
32    }
33}