From cbf4c6572a50fc190ca4e534a9ff625ba6471a9d Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 16 Apr 2024 15:34:12 +0200 Subject: [PATCH] fixed hbasm --- hbasm/src/ins.rs | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/hbasm/src/ins.rs b/hbasm/src/ins.rs index ea43559c..4b4a2402 100644 --- a/hbasm/src/ins.rs +++ b/hbasm/src/ins.rs @@ -288,23 +288,25 @@ macro_rules! instructions { ($module:expr, $obj:expr $(,)?) { $($opcode:expr, $mnemonic:ident, $ops:tt, $doc:literal;)* } ) => {{ - let (module, obj) = ($module, $obj); - $({ - // Object is shared across all functions - let obj = Rc::clone(&obj); + paste::paste! { + let (module, obj) = ($module, $obj); + $({ + // Object is shared across all functions + let obj = Rc::clone(&obj); - // Register newly generated function for each instruction - FuncRegistration::new(stringify!([<$mnemonic:lower>])) - .with_namespace(rhai::FnNamespace::Global) - .set_into_module::<_, { generic::gen_ins_fn!(@arg_count $ops) }, false, _, true, _>( - module, - generic::gen_ins_fn!( - obj, - $opcode, - $ops - ) - ); - })* + // Register newly generated function for each instruction + FuncRegistration::new(stringify!([<$mnemonic:lower>])) + .with_namespace(rhai::FnNamespace::Global) + .set_into_module::<_, { generic::gen_ins_fn!(@arg_count $ops) }, false, _, true, _>( + module, + generic::gen_ins_fn!( + obj, + $opcode, + $ops + ) + ); + })* + } }}; }