luaur_bytecode/methods/
call_inliner_make_fixed_consumer.rs1use crate::records::bc_call::BcCall;
2use crate::records::bc_call_fb::BcCallFB;
3use crate::records::bc_function::BcFunction;
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 luaur_common::enums::luau_opcode::LuauOpcode;
9use luaur_common::macros::luau_unreachable::LUAU_UNREACHABLE;
10
11impl<'a> crate::records::call_inliner::CallInliner<'a> {
12 pub fn make_fixed_consumer(&mut self, inst: &mut BcRef<'a, BcInst>) {
13 match unsafe { (*inst.operator_arrow()).op } {
14 LuauOpcode::LOP_SETLIST => {
15 let mut set_list =
16 BcSetList::<crate::records::bc_op::BcOp>::from(self.caller, inst.clone());
17 let count = set_list.params().len() as u32;
18 set_list.set_count(count);
19 }
20 LuauOpcode::LOP_RETURN => {
21 let mut ret =
22 BcReturn::<crate::records::bc_op::BcOp>::from(self.caller, inst.clone());
23 let count = ret.values().len() as u32;
24 ret.set_return_count(count);
25 }
26 LuauOpcode::LOP_CALLFB => {
27 let mut call_fb =
28 BcCallFB::<crate::records::bc_op::BcOp>::from(self.caller, inst.clone());
29 let count = call_fb.params().len() as u32;
30 call_fb.set_param_count(count);
31 }
32 LuauOpcode::LOP_CALL => {
33 let mut call =
34 BcCall::<crate::records::bc_op::BcOp>::from(self.caller, inst.clone());
35 let count = call.params().len() as u32;
36 call.set_param_count(count);
37 }
38 _ => {
39 LUAU_UNREACHABLE!();
40 }
41 }
42 }
43}