Browse Source

bug fixes

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

19
src/lib/exec.rs

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

4
src/lib/js/value.rs

@ -193,10 +193,10 @@ impl ValueData {
ValueData::Function(ref func) => {
match *func.borrow_mut().deref_mut() {
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) => {
f.object.insert(field.clone(), Property::new(val))
f.object.insert(field.clone(), Property::new(val.clone()))
}
};
}

Loading…
Cancel
Save