luaur_bytecode/methods/
bytecode_builder_begin_function.rs1use crate::records::bytecode_builder::BytecodeBuilder;
2use luaur_common::macros::luau_assert::LUAU_ASSERT;
3
4impl BytecodeBuilder {
5 pub fn begin_function(&mut self, numparams: u8, isvararg: bool) -> u32 {
6 LUAU_ASSERT!(self.current_function == u32::MAX);
7
8 let id = self.functions.len() as u32;
9
10 let mut func = crate::records::function::Function::default();
11 func.numparams = numparams;
12 func.isvararg = isvararg;
13
14 self.functions.push(func);
15
16 self.current_function = id;
17
18 self.has_long_jumps = false;
19 self.debug_line = 0;
20
21 id
22 }
23}