diff options
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/chunk.rs')
-rw-r--r-- | users/tazjin/rlox/src/bytecode/chunk.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/users/tazjin/rlox/src/bytecode/chunk.rs b/users/tazjin/rlox/src/bytecode/chunk.rs index b9a3994fe1c1..fc5cd34fdf4f 100644 --- a/users/tazjin/rlox/src/bytecode/chunk.rs +++ b/users/tazjin/rlox/src/bytecode/chunk.rs @@ -1,6 +1,6 @@ use std::ops::Index; -use super::opcode::{ConstantIdx, OpCode}; +use super::opcode::{CodeIdx, ConstantIdx, OpCode}; use super::value; // In the book, this type is a hand-rolled dynamic array @@ -25,11 +25,11 @@ struct Span { } impl Chunk { - pub fn add_op(&mut self, data: OpCode, line: usize) -> usize { + pub fn add_op(&mut self, data: OpCode, line: usize) -> CodeIdx { let idx = self.code.len(); self.code.push(data); self.add_line(line); - idx + CodeIdx(idx) } pub fn add_constant(&mut self, data: value::Value) -> usize { |