1use crate::ScopeId;
2
3#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct ScopeMeta {
6 id: ScopeId,
7 debug_name: String,
8 parent: Option<ScopeId>,
9 closed: bool,
10}
11
12impl ScopeMeta {
13 pub(crate) fn new(id: ScopeId, debug_name: impl Into<String>, parent: Option<ScopeId>) -> Self {
14 Self {
15 id,
16 debug_name: debug_name.into(),
17 parent,
18 closed: false,
19 }
20 }
21
22 pub fn id(&self) -> ScopeId {
24 self.id
25 }
26
27 pub fn debug_name(&self) -> &str {
29 &self.debug_name
30 }
31
32 pub fn parent(&self) -> Option<ScopeId> {
34 self.parent
35 }
36
37 pub fn is_closed(&self) -> bool {
39 self.closed
40 }
41
42 pub(crate) fn close(&mut self) {
43 self.closed = true;
44 }
45}