forked from AbleScript/ablescript
Function negation
This commit is contained in:
parent
6ee12a7c91
commit
65bb29d401
|
@ -443,7 +443,27 @@ impl ops::Not for Value {
|
|||
Abool::Sometimes => Abool::Sometimes,
|
||||
Abool::Always => Abool::Never,
|
||||
}),
|
||||
Value::Functio(_) => todo!(),
|
||||
Value::Functio(f) => Value::Functio(match f {
|
||||
Functio::BfFunctio {
|
||||
mut instructions,
|
||||
tape_len,
|
||||
} => {
|
||||
instructions.reverse();
|
||||
Functio::BfFunctio {
|
||||
instructions,
|
||||
tape_len,
|
||||
}
|
||||
}
|
||||
Functio::AbleFunctio {
|
||||
mut params,
|
||||
mut body,
|
||||
} => {
|
||||
params.reverse();
|
||||
body.reverse();
|
||||
Functio::AbleFunctio { params, body }
|
||||
}
|
||||
Functio::Eval(code) => Functio::Eval(code.chars().rev().collect()),
|
||||
}),
|
||||
Value::Cart(c) => Value::Cart(
|
||||
c.into_iter()
|
||||
.map(|(k, v)| (v.borrow().clone(), Rc::new(RefCell::new(k))))
|
||||
|
|
Loading…
Reference in a new issue