Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/tx3-lang/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ pub struct Scope {
pub(crate) parent: Option<Rc<Scope>>,
}

impl Scope {
pub fn symbols(&self) -> &HashMap<String, Symbol> {
&self.symbols
}

pub fn parent(&self) -> Option<&Rc<Scope>> {
self.parent.as_ref()
}
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Symbol {
EnvVar(String, Box<Type>),
Expand Down Expand Up @@ -186,6 +196,12 @@ pub struct Program {
pub(crate) scope: Option<Rc<Scope>>,
}

impl Program {
pub fn scope(&self) -> Option<&Rc<Scope>> {
self.scope.as_ref()
}
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct EnvField {
pub name: String,
Expand Down