MCPcopy Create free account
hub / github.com/d0iasm/saba / get_variable

Method get_variable

core/src/renderer/js/runtime.rs:112–124  ·  view source on GitHub ↗
(&self, name: String)

Source from the content-addressed store, hash-verified

110 }
111
112 pub fn get_variable(&self, name: String) -> Option<RuntimeValue> {
113 for variable in &self.variables {
114 if variable.0 == name {
115 return variable.1.clone();
116 }
117 }
118
119 if let Some(env) = &self.outer {
120 env.borrow_mut().get_variable(name)
121 } else {
122 None
123 }
124 }
125
126 fn add_variable(&mut self, name: String, value: Option<RuntimeValue>) {
127 self.variables.push((name, value));

Callers 1

evalMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected