about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/mod.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/bytecode/mod.rs b/users/tazjin/rlox/src/bytecode/mod.rs
index de04d7b06f4d..2d83c4272239 100644
--- a/users/tazjin/rlox/src/bytecode/mod.rs
+++ b/users/tazjin/rlox/src/bytecode/mod.rs
@@ -16,7 +16,12 @@ pub fn main() {
 
     let constant = chunk.add_constant(1.2);
     chunk.add_op(OpCode::OpConstant(constant), 1);
-    chunk.add_op(OpCode::OpReturn, 1);
+
+    let constant = chunk.add_constant(2.0);
+    chunk.add_op(OpCode::OpConstant(constant), 2);
+
+    chunk.add_op(OpCode::OpAdd, 3);
+    chunk.add_op(OpCode::OpReturn, 4);
 
     vm::interpret(chunk).expect("it should work");
 }