diff --git a/lunar_wave_vm/src/state.rs b/lunar_wave_vm/src/state.rs index f4265e2..89682d8 100644 --- a/lunar_wave_vm/src/state.rs +++ b/lunar_wave_vm/src/state.rs @@ -510,9 +510,9 @@ impl State { self.current_block = Rc::clone (&self.chunk.blocks [frame.block_idx]); } - fn fetch (&self) -> Instruction { + fn fetch (&self) -> &Instruction { match self.current_block.instructions.get (self.stack_top.program_counter) { - Some (x) => *x, + Some (x) => x, None => { dbg! (&self.stack, &self.stack_top); panic! ("program_counter went out of bounds"); @@ -532,7 +532,7 @@ impl State { self.make_step_error (msg, &instruction) }; - match instruction { + match *instruction { Instruction::Add (a, b, c) => { if self.op_add (a, b, c) { self.stack_top.program_counter += 1;