Skip to main content

luaur_bytecode/methods/
bytecode_graph_serializer_get_imm_bool.rs

1use crate::enums::bc_imm_kind::BcImmKind;
2use crate::records::bc_imm::BcImm;
3use crate::records::bc_inst::BcInst;
4use crate::records::bytecode_graph_serializer::BytecodeGraphSerializer;
5use luaur_common::macros::luau_assert::LUAU_ASSERT;
6
7impl<'a> BytecodeGraphSerializer<'a> {
8    pub fn get_imm_bool(&mut self, insn: &mut BcInst, index: u8) -> bool {
9        let imm: &mut BcImm = self.get_imm(insn, index);
10        LUAU_ASSERT!(imm.kind == BcImmKind::Boolean);
11        unsafe { imm.value.valueBoolean }
12    }
13}