feat(tazjin/rlox): Implement unary negation operator
Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572 Reviewed-by: tazjin <mail@tazj.in> Tested-by: BuildkiteCI
This commit is contained in:
parent
47ffa80711
commit
2d9456d247
5 changed files with 32 additions and 0 deletions
|
|
@ -4,3 +4,13 @@ pub enum Value {
|
|||
Bool(bool),
|
||||
Number(f64),
|
||||
}
|
||||
|
||||
impl Value {
|
||||
pub fn is_falsey(&self) -> bool {
|
||||
match self {
|
||||
Value::Nil => true,
|
||||
Value::Bool(false) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue