Skip to main content

luaur_code_gen/methods/
const_prop_state_invalidate_registers_from.rs

1impl crate::records::const_prop_state::ConstPropState {
2    pub fn invalidate_registers_from(&mut self, first_reg: i32) {
3        for i in first_reg..=self.max_reg {
4            let idx = i as usize;
5            // Avoid borrowing `self` (and `self.regs[idx]`) mutably more than once:
6            // - take a raw pointer to the register slot
7            // - perform the invalidation call using the raw pointer as a mutable ref
8            let reg_ptr: *mut crate::records::register_info::RegisterInfo = &mut self.regs[idx];
9            unsafe {
10                self.invalidate_register_info_bool_bool(&mut *reg_ptr, true, true);
11            }
12        }
13    }
14}