Skip to main content

luaur_bytecode/macros/
vm_const.rs

1#[allow(unused_macros)]
2#[macro_export]
3macro_rules! VM_CONST {
4    ($name:ident, $idx:expr) => {
5        #[allow(non_upper_case_globals)]
6        pub(crate) const $name: u32 = $idx;
7
8        #[allow(non_snake_case)]
9        pub(crate) fn $name(
10            &self,
11        ) -> crate::records::bc_ref::BcRef<crate::records::vm_const::VmConst> {
12            self.getVmConst($idx)
13        }
14
15        paste::paste! {
16            #[allow(non_snake_case)]
17            pub(crate) fn [<set $name>](&mut self, cid: u32) {
18                self.setVmConst($idx, cid);
19            }
20        }
21    };
22}
23
24pub use VM_CONST;