We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6cae059 commit e766eb3Copy full SHA for e766eb3
2 files changed
src/environment/environment.rs
@@ -98,6 +98,28 @@ impl<A: Clone> Environment<A> {
98
pub fn pop(&mut self) -> () {
99
self.stack.pop_front();
100
}
101
+
102
+ pub fn get_all_variables(&self) -> Vec<(Name, A)> {
103
+ let mut vars = Vec::new();
104
105
+ // First get variables from local scopes (in reverse order to respect shadowing)
106
+ for scope in self.stack.iter() {
107
+ for (name, value) in &scope.variables {
108
+ if !vars.iter().any(|(n, _)| n == name) {
109
+ vars.push((name.clone(), value.clone()));
110
+ }
111
112
113
114
+ // Then get variables from global scope (if not already found)
115
+ for (name, value) in &self.globals.variables {
116
117
118
119
120
121
+ vars
122
123
124
125
#[cfg(test)]
0 commit comments