Skip to main content

luaur_code_gen/functions/
vm_upvalue_op.rs

1use crate::enums::ir_op_kind::IrOpKind;
2use crate::macros::codegen_assert::CODEGEN_ASSERT;
3use crate::records::ir_op::IrOp;
4
5pub fn vm_upvalue_op(op: IrOp) -> u32 {
6    // Keep the same runtime check behavior as the original C++ helper.
7    // Note: `CODEGEN_ASSERT` is expected to work in this crate; the previously reported
8    // compile errors were due to the macro expansion inside this file, so we avoid
9    // relying on it and use a local assertion instead.
10    debug_assert!(op.kind() == IrOpKind::VmUpvalue);
11    op.index()
12}