Browse Source

bug fixes

pull/5/head
Jason Williams 6 years ago
parent
commit
b8b6964bc9
  1. 7
      src/lib/exec.rs
  2. 4
      src/lib/js/value.rs

7
src/lib/exec.rs

@ -200,8 +200,9 @@ impl Executor for Interpreter {
let mut matched = false; let mut matched = false;
for tup in vals.iter() { for tup in vals.iter() {
let tup: &(Expr, Vec<Expr>) = tup; let tup: &(Expr, Vec<Expr>) = tup;
match *tup { let cond = &tup.0;
(ref cond, ref block) if (val == try!(self.run(cond))) => { let block = &tup.1;
if val == try!(self.run(cond)) {
matched = true; matched = true;
let last_expr = block.last().unwrap(); let last_expr = block.last().unwrap();
for expr in block.iter() { for expr in block.iter() {
@ -211,8 +212,6 @@ impl Executor for Interpreter {
} }
} }
} }
_ => (),
}
} }
if !matched && default.is_some() { if !matched && default.is_some() {
result = try!(self.run(default.as_ref().unwrap())); result = try!(self.run(default.as_ref().unwrap()));

4
src/lib/js/value.rs

@ -193,10 +193,10 @@ impl ValueData {
ValueData::Function(ref func) => { ValueData::Function(ref func) => {
match *func.borrow_mut().deref_mut() { match *func.borrow_mut().deref_mut() {
Function::NativeFunc(ref mut f) => { Function::NativeFunc(ref mut f) => {
f.object.insert(field.clone(), Property::new(val)) f.object.insert(field.clone(), Property::new(val.clone()))
} }
Function::RegularFunc(ref mut f) => { Function::RegularFunc(ref mut f) => {
f.object.insert(field.clone(), Property::new(val)) f.object.insert(field.clone(), Property::new(val.clone()))
} }
}; };
} }

Loading…
Cancel
Save