feat(tazjin/rlox): Implement equality operator

Change-Id: I5587a11646e228c5af4dc7ca6da026bb4a2592a6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2574
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-02-28 15:57:08 +02:00 committed by tazjin
parent 93c30b339c
commit c58fe2093e
4 changed files with 50 additions and 6 deletions

View file

@ -85,6 +85,12 @@ impl VM {
self.push(Value::Bool(v.is_falsey()));
}
OpCode::OpEqual => {
let b = self.pop();
let a = self.pop();
self.push(Value::Bool(a == b));
}
OpCode::OpNegate => {
let v = self.pop();
with_type!(