luaur_code_gen/methods/
const_prop_state_save_value.rs1use crate::enums::ir_op_kind::IrOpKind;
2use crate::macros::codegen_assert::CODEGEN_ASSERT;
3use crate::records::const_prop_state::ConstPropState;
4use crate::records::ir_op::IrOp;
5use crate::records::register_info::RegisterInfo;
6
7impl ConstPropState {
8 pub fn save_value(&mut self, op: IrOp, value: IrOp) {
9 CODEGEN_ASSERT!(value.kind() == IrOpKind::Constant);
10
11 if let Some(info) = self.try_get_register_info(op) {
12 unsafe {
13 if (*info).value != value {
14 (*info).value = value;
15
16 if !luaur_common::FFlag::LuauCodegenExtraTableOpts.get() {
17 (*info).known_not_readonly_deprecated = false;
18 (*info).known_no_metatable_deprecated = false;
19 (*info).known_table_array_size_deprecated = -1;
20 }
21
22 (*info).version += 1;
23 }
24 }
25 }
26 }
27}