superui_boa_engine 0.1.1

Fork of boa_engine (boa 0.21.1) vendored for superui so the boa_parser stack-growth patch is publishable; also carries a relaxed icu_normalizer pin. See docs/fork-patches.md. Upstream: https://github.com/boa-dev/boa
use boa_gc::{Finalize, Trace, empty_trace};

use crate::JsString;

/// Private runtime environment.
#[derive(Clone, Debug, Finalize)]
pub(crate) struct PrivateEnvironment {
    /// The unique identifier of the private names.
    id: usize,

    /// The `[[Description]]` internal slot of the private names.
    descriptions: Vec<JsString>,
}

// Safety: PrivateEnvironment does not contain any objects that need to be traced.
unsafe impl Trace for PrivateEnvironment {
    empty_trace!();
}

impl PrivateEnvironment {
    /// Creates a new `PrivateEnvironment`.
    pub(crate) fn new(id: usize, descriptions: Vec<JsString>) -> Self {
        Self { id, descriptions }
    }

    /// Gets the id of this private environment.
    pub(crate) const fn id(&self) -> usize {
        self.id
    }

    /// Gets the descriptions of this private environment.
    pub(crate) fn descriptions(&self) -> &[JsString] {
        &self.descriptions
    }
}