Skip to main content

luaur_bytecode/macros/
jump_to.rs

1#[allow(unused_macros)]
2#[macro_export]
3macro_rules! JUMP_TO {
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::bc_block::BcBlock> {
12            self.getBlock($idx)
13        }
14
15        paste::paste! {
16            #[allow(non_snake_case)]
17            pub(crate) fn [<set $name>](&mut self, block: crate::records::bc_op::BcOp) {
18                self.setBcOp($idx, block);
19            }
20        }
21    };
22}
23
24pub use JUMP_TO;