luaur_bytecode/methods/
call_inliner_is_multi_consumer.rs1use crate::records::bc_call::BcCall;
2use crate::records::bc_call_fb::BcCallFB;
3use crate::records::bc_function::{BcFunction, VmConst};
4use crate::records::bc_inst::BcInst;
5use crate::records::bc_ref::BcRef;
6use crate::records::bc_return::BcReturn;
7use crate::records::bc_set_list::BcSetList;
8use crate::records::call_inliner::CallInliner;
9use luaur_common::enums::luau_opcode::LuauOpcode;
10
11impl<'a> CallInliner<'a> {
12 pub fn is_multi_consumer(&self, inst: &BcRef<'a, BcInst>) -> bool {
13 let op = unsafe { (*inst.operator_arrow()).op };
14 let caller = self.caller as *const BcFunction as *mut BcFunction;
15 match op {
16 LuauOpcode::LOP_SETLIST => BcSetList::<VmConst>::from(caller, *inst).count() < 0,
17 LuauOpcode::LOP_RETURN => BcReturn::<VmConst>::from(caller, *inst).return_count() < 0,
18 LuauOpcode::LOP_CALLFB => BcCallFB::<VmConst>::from(caller, *inst).param_count() < 0,
19 LuauOpcode::LOP_CALL => BcCall::<VmConst>::from(caller, *inst).param_count() < 0,
20 _ => false,
21 }
22 }
23}