we now parse witx paths and the ctx type name in the macro invocation
This commit is contained in:
@@ -20,9 +20,9 @@ use types::define_datatype;
|
||||
pub fn from_witx(args: TokenStream) -> TokenStream {
|
||||
let config = parse_macro_input!(args as Config);
|
||||
|
||||
let names = Names::new(); // TODO parse the names from the invocation of the macro, or from a file?
|
||||
let doc = witx::load(&config.witx.paths).expect("loading witx");
|
||||
|
||||
let doc = witx::load(&config.witx_paths()).expect("loading witx");
|
||||
let names = Names::new(config); // TODO parse the names from the invocation of the macro, or from a file?
|
||||
|
||||
let types = doc.typenames().map(|t| define_datatype(&names, &t));
|
||||
|
||||
@@ -30,9 +30,10 @@ pub fn from_witx(args: TokenStream) -> TokenStream {
|
||||
let modname = names.module(&module.name);
|
||||
let fs = module.funcs().map(|f| define_func(&names, &f));
|
||||
let modtrait = define_module_trait(&names, &module);
|
||||
let ctx_type = names.ctx_type();
|
||||
quote!(
|
||||
mod #modname {
|
||||
use super::WasiCtx;
|
||||
use super::#ctx_type;
|
||||
use super::types::*;
|
||||
#(#fs)*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user