Fix lookup_binding in function call case

This commit is contained in:
greg 2016-01-24 15:52:18 -08:00
parent 5eba222679
commit c36bc3377e

View File

@ -52,8 +52,6 @@ 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())
.or_else(|| {
for frame in self.frames.iter() { for frame in self.frames.iter() {
match frame.map.get(&var) { match frame.map.get(&var) {
None => (), None => (),
@ -61,8 +59,7 @@ impl Evaluator {
} }
} }
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) {