From 1d6b5ca6dbd519b768ac9e9ce60ea59606006f83 Mon Sep 17 00:00:00 2001 From: sofia-bobbiesi Date: Mon, 15 Dec 2025 15:18:17 -0300 Subject: [PATCH] feat: add scope inspection methods to Scope and Program structs --- crates/tx3-lang/src/ast.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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,