luaur-bytecode 0.1.3

Luau bytecode format and builder (Rust).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::enums::bc_op_kind::BcOpKind;
use crate::records::bc_function::VmConst;
use crate::records::bc_inst_helper::BcInstHelper;
use crate::records::bc_ref::BcRef;
use luaur_common::macros::luau_assert::LUAU_ASSERT;

impl BcInstHelper<'_> {
    pub fn get_vm_const(&mut self, input_idx: u32) -> BcRef<'_, VmConst> {
        let const_op = self.inst.operator_deref().ops[input_idx as usize];
        LUAU_ASSERT!(const_op.kind == BcOpKind::VmConst);
        self.graph.vm_const(const_op)
    }
}