1
0
This commit is contained in:
Jeff 2024-11-06 15:14:12 -05:00
parent d587d87ed7
commit 74bb8a429a

View File

@ -502,15 +502,11 @@ impl Vm {
log::trace!("Change R{to_register} to R{from_register}"); log::trace!("Change R{to_register} to R{from_register}");
self.stack[to_register] = Register::Pointer(from_register); self.stack[to_register] = Register::Pointer(from_register);
Ok(())
} }
Ordering::Equal => { Ordering::Equal => {
log::trace!("Set R{to_register} to R{from_register}"); log::trace!("Set R{to_register} to R{from_register}");
self.stack.push(Register::Pointer(from_register)); self.stack.push(Register::Pointer(from_register));
Ok(())
} }
Ordering::Greater => { Ordering::Greater => {
let difference = to_register - length; let difference = to_register - length;
@ -524,11 +520,11 @@ impl Vm {
log::trace!("Set R{to_register} to R{from_register}"); log::trace!("Set R{to_register} to R{from_register}");
self.stack.push(Register::Pointer(from_register)); self.stack.push(Register::Pointer(from_register));
}
}
Ok(()) Ok(())
} }
}
}
fn set_constant( fn set_constant(
&mut self, &mut self,
@ -550,15 +546,11 @@ impl Vm {
log::trace!("Change R{to_register} to C{constant_index}"); log::trace!("Change R{to_register} to C{constant_index}");
self.stack[to_register] = Register::Constant(constant_index); self.stack[to_register] = Register::Constant(constant_index);
Ok(())
} }
Ordering::Equal => { Ordering::Equal => {
log::trace!("Set R{to_register} to C{constant_index}"); log::trace!("Set R{to_register} to C{constant_index}");
self.stack.push(Register::Constant(constant_index)); self.stack.push(Register::Constant(constant_index));
Ok(())
} }
Ordering::Greater => { Ordering::Greater => {
let difference = to_register - length; let difference = to_register - length;
@ -572,11 +564,11 @@ impl Vm {
log::trace!("Set R{to_register} to C{constant_index}"); log::trace!("Set R{to_register} to C{constant_index}");
self.stack.push(Register::Constant(constant_index)); self.stack.push(Register::Constant(constant_index));
}
}
Ok(()) Ok(())
} }
}
}
fn get_constant(&self, index: u8, position: Span) -> Result<&Value, VmError> { fn get_constant(&self, index: u8, position: Span) -> Result<&Value, VmError> {
self.chunk self.chunk