diff --git a/crates/tx3-lang/src/ast.rs b/crates/tx3-lang/src/ast.rs index 1c89006a..0483bc13 100644 --- a/crates/tx3-lang/src/ast.rs +++ b/crates/tx3-lang/src/ast.rs @@ -17,6 +17,16 @@ pub struct Scope { pub(crate) parent: Option>, } +impl Scope { + pub fn symbols(&self) -> &HashMap { + &self.symbols + } + + pub fn parent(&self) -> Option<&Rc> { + self.parent.as_ref() + } +} + #[derive(Debug, Clone, PartialEq, Eq)] pub enum Symbol { EnvVar(String, Box), @@ -186,6 +196,12 @@ pub struct Program { pub(crate) scope: Option>, } +impl Program { + pub fn scope(&self) -> Option<&Rc> { + self.scope.as_ref() + } +} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct EnvField { pub name: String,