fix(napi-derive-backend): always generate CallContext for constructor function
This commit is contained in:
parent
d08f9b03e0
commit
813d671d76
1 changed files with 11 additions and 10 deletions
|
@ -39,16 +39,17 @@ impl TryToTokens for NapiFn {
|
|||
}
|
||||
};
|
||||
|
||||
let function_call = if args_len == 0 && self.fn_self.is_none() {
|
||||
quote! { #native_call }
|
||||
} else {
|
||||
quote! {
|
||||
CallbackInfo::<#args_len>::new(env, cb, None).and_then(|mut cb| {
|
||||
#(#arg_conversions)*
|
||||
#native_call
|
||||
})
|
||||
}
|
||||
};
|
||||
let function_call =
|
||||
if args_len == 0 && self.fn_self.is_none() && self.kind != FnKind::Constructor {
|
||||
quote! { #native_call }
|
||||
} else {
|
||||
quote! {
|
||||
CallbackInfo::<#args_len>::new(env, cb, None).and_then(|mut cb| {
|
||||
#(#arg_conversions)*
|
||||
#native_call
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
(quote! {
|
||||
#(#attrs)*
|
||||
|
|
Loading…
Reference in a new issue