1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::value::Value;
use std::ops::Neg;

impl<'vm> Neg for Value<'vm> {
    type Output = Value<'vm>;

    fn neg(self) -> Self::Output {
        match self {
            Value::None => Value::None,
            Value::Bool(b) => Value::Bool(!b),
            Value::Number(n) => Value::Number(-n),
            v => v,
        }
    }
}