use boa_gc::{Finalize, Trace};
use crate::JsValue;
use super::PoisonableEnvironment;
#[derive(Debug, Trace, Finalize)]
pub(crate) struct LexicalEnvironment {
inner: PoisonableEnvironment,
}
impl LexicalEnvironment {
pub(crate) fn new(bindings: u32, poisoned: bool, with: bool) -> Self {
Self {
inner: PoisonableEnvironment::new(bindings, poisoned, with),
}
}
pub(crate) const fn poisonable_environment(&self) -> &PoisonableEnvironment {
&self.inner
}
#[track_caller]
pub(crate) fn get(&self, index: u32) -> Option<JsValue> {
self.inner.get(index)
}
#[track_caller]
pub(crate) fn set(&self, index: u32, value: JsValue) {
self.inner.set(index, value);
}
}