Skip to main content

luaur_bytecode/methods/
bytecode_builder_add_constant_closure.rs

1use crate::records::bytecode_builder::BytecodeBuilder;
2use crate::records::constant::Constant;
3use crate::records::constant::ConstantValue;
4use crate::records::constant_key::ConstantKey;
5
6impl BytecodeBuilder {
7    pub fn add_constant_closure(&mut self, fid: u32) -> i32 {
8        let c = Constant {
9            r#type: crate::enums::r#type::Type::Type_Closure,
10            value: ConstantValue { valueClosure: fid },
11        };
12
13        let k = ConstantKey {
14            r#type: crate::enums::r#type::Type::Type_Closure,
15            value: fid as u64,
16            extra: 0,
17        };
18
19        self.add_constant(k, c)
20    }
21}