Skip to main content

luaur_bytecode/methods/
bytecode_graph_serializer_get_proto_input.rs

1use crate::enums::bc_op_kind::BcOpKind;
2use crate::records::bc_function::BcFunction;
3use crate::records::bc_inst::BcInst;
4use crate::records::bc_op::BcOp;
5use luaur_common::macros::luau_assert::LUAU_ASSERT;
6
7impl<'a> crate::records::bytecode_graph_serializer::BytecodeGraphSerializer<'a> {
8    pub fn get_proto_input(&mut self, insn: &mut BcInst, index: u8) -> u16 {
9        LUAU_ASSERT!(index < insn.ops.len() as u8);
10        let inp = insn.ops[index as usize];
11        LUAU_ASSERT!(inp.kind == BcOpKind::VmProto);
12
13        if inp.index > 0xffff {
14            self.error = true;
15        }
16
17        inp.index as u16
18    }
19}