Skip to content

Commit 62137b7

Browse files
committed
handle asyncness
1 parent 5d6e69b commit 62137b7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

crates/anodized-core/src/instrument.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,20 @@ impl Mode {
113113
FnArg::Typed(pat_type) => pat_type.pat.to_token_stream(),
114114
});
115115

116-
let self_type = if is_impl {
116+
let maybe_self = if is_impl {
117117
quote::quote!(Self::)
118118
} else {
119119
quote::quote!()
120120
};
121121

122+
let maybe_await = match &sig.asyncness {
123+
Some(_) => quote::quote!(.await),
124+
None => quote::quote!(),
125+
};
126+
122127
*body = parse_quote! {
123128
{
124-
match #self_type #mangled_ident(#(#args),*) {
129+
match #maybe_self #mangled_ident(#(#args),*) #maybe_await {
125130
Ok(output) => output,
126131
Err((false, errors)) => panic!("precondition failed:{errors}"),
127132
Err((true, errors)) => panic!("postcondition failed:{errors}"),

0 commit comments

Comments
 (0)