mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
proc: expose: fix output match statement
This commit is contained in:
parent
7df7cb839c
commit
c56b08c24e
2 changed files with 10 additions and 2 deletions
|
|
@ -92,7 +92,9 @@ impl ToTokens for CommandVariant {
|
|||
out.append(Group::new(Delimiter::Parenthesis, {
|
||||
let mut out = TokenStream2::new();
|
||||
for arg in args.iter() {
|
||||
if let FnArg::Typed(PatType { attrs, pat, colon_token, ty }) = arg {
|
||||
if let FnArg::Typed(PatType {
|
||||
attrs, pat, colon_token, ty
|
||||
}) = arg {
|
||||
out.append(LitStr::new(
|
||||
&format!("{}", quote! { #ty }),
|
||||
Span::call_site()
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ impl ToTokens for ExposeImpl {
|
|||
],
|
||||
_ => vec![],
|
||||
};
|
||||
let values = variants.values();
|
||||
let values = variants.iter().map(|(k, v)|ExposeArm(k.clone(), v.clone()));
|
||||
let trait_impl = quote! {
|
||||
impl ::tengri::dsl::Context<#t> for #target {
|
||||
fn get (&self, dsl: &::tengri::dsl::Value) -> Option<#t> {
|
||||
|
|
@ -97,6 +97,9 @@ impl ToTokens for ExposeImpl {
|
|||
out.append(token);
|
||||
}
|
||||
}
|
||||
//if exposed.len() > 0 {
|
||||
//panic!("{}", quote! {#out});
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -122,9 +125,12 @@ impl ToTokens for ExposeArm {
|
|||
}));
|
||||
out.append(Punct::new('=', Joint));
|
||||
out.append(Punct::new('>', Alone));
|
||||
out.append(Ident::new("self", Span::call_site()));
|
||||
out.append(Punct::new('.', Alone));
|
||||
for token in quote! { #value } {
|
||||
out.append(token);
|
||||
}
|
||||
out.append(Group::new(Delimiter::Parenthesis, TokenStream2::new()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue