forked from AbleScript/ablescript
Coerce indexing assignments into non-carts
This commit is contained in:
parent
9712d58962
commit
99f84dfd5b
|
@ -11,6 +11,7 @@ use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::{HashMap, VecDeque},
|
collections::{HashMap, VecDeque},
|
||||||
io::{stdin, stdout, Read, Write},
|
io::{stdin, stdout, Read, Write},
|
||||||
|
mem::swap,
|
||||||
ops::Range,
|
ops::Range,
|
||||||
process::exit,
|
process::exit,
|
||||||
rc::Rc,
|
rc::Rc,
|
||||||
|
@ -266,7 +267,18 @@ impl ExecEnv {
|
||||||
c.insert(index, Rc::clone(&next_cell));
|
c.insert(index, Rc::clone(&next_cell));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => todo!(),
|
x => {
|
||||||
|
// Annoying borrow checker dance
|
||||||
|
// to move *x.
|
||||||
|
let mut tmp = Value::Nul;
|
||||||
|
swap(&mut tmp, x);
|
||||||
|
|
||||||
|
let mut c = tmp.into_cart();
|
||||||
|
next_cell =
|
||||||
|
Rc::new(RefCell::new(Value::Cart(Default::default())));
|
||||||
|
c.insert(index, Rc::clone(&next_cell));
|
||||||
|
*x = Value::Cart(c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cell = next_cell;
|
cell = next_cell;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue