Fix lookup_binding in function call case
This commit is contained in:
parent
5eba222679
commit
c36bc3377e
17
src/eval.rs
17
src/eval.rs
@ -52,17 +52,14 @@ impl Evaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn lookup_binding(&mut self, var: String) -> Option<Expression> {
|
fn lookup_binding(&mut self, var: String) -> Option<Expression> {
|
||||||
self.varmap.map.get(&var).map(|expr| expr.clone())
|
for frame in self.frames.iter() {
|
||||||
.or_else(|| {
|
match frame.map.get(&var) {
|
||||||
for frame in self.frames.iter() {
|
None => (),
|
||||||
match frame.map.get(&var) {
|
Some(expr) => return Some(expr.clone()),
|
||||||
None => (),
|
}
|
||||||
Some(expr) => return Some(expr.clone()),
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
self.varmap.map.get(&var).map(|expr| expr.clone())
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_function(&mut self, name: String, function: Function) {
|
fn add_function(&mut self, name: String, function: Function) {
|
||||||
|
Loading…
Reference in New Issue
Block a user