Add combine_with_exported_module.
This commit is contained in:
committed by
J Henry Waugh
parent
aed70db303
commit
848bdf3f01
@@ -17,6 +17,7 @@ pub(crate) fn generate_body(
|
||||
let mut set_fn_stmts: Vec<syn::Stmt> = Vec::new();
|
||||
let mut set_const_stmts: Vec<syn::Stmt> = Vec::new();
|
||||
let mut add_mod_blocks: Vec<syn::ExprBlock> = Vec::new();
|
||||
let mut set_mod_blocks: Vec<syn::ExprBlock> = Vec::new();
|
||||
let str_type_path = syn::parse2::<syn::Path>(quote! { str }).unwrap();
|
||||
|
||||
for (const_name, const_expr) in consts {
|
||||
@@ -54,6 +55,14 @@ pub(crate) fn generate_body(
|
||||
})
|
||||
.unwrap(),
|
||||
);
|
||||
set_mod_blocks.push(
|
||||
syn::parse2::<syn::ExprBlock>(quote! {
|
||||
#(#cfg_attrs)* {
|
||||
self::#module_name::rhai_generate_into_module(m);
|
||||
}
|
||||
})
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
// NB: these are token streams, because reparsing messes up "> >" vs ">>"
|
||||
@@ -137,6 +146,11 @@ pub(crate) fn generate_body(
|
||||
#(#add_mod_blocks)*
|
||||
m
|
||||
}
|
||||
pub fn rhai_generate_into_module(m: &mut Module) {
|
||||
#(#set_fn_stmts)*
|
||||
#(#set_const_stmts)*
|
||||
#(#set_mod_blocks)*
|
||||
}
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
|
Reference in New Issue
Block a user