summaryrefslogtreecommitdiff
path: root/ops/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ops/lib.rs')
-rw-r--r--ops/lib.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/ops/lib.rs b/ops/lib.rs
index bd87bc492..aee6c8c03 100644
--- a/ops/lib.rs
+++ b/ops/lib.rs
@@ -184,19 +184,23 @@ impl Op {
#[doc(hidden)]
impl #name {
- pub fn name() -> &'static str {
+ pub const fn name() -> &'static str {
stringify!(#name)
}
- pub fn v8_fn_ptr #generics () -> #core::v8::FunctionCallback #where_clause {
- use #core::v8::MapFnTo;
- Self::v8_func::<#type_params>.map_fn_to()
+ #[allow(clippy::not_unsafe_ptr_arg_deref)]
+ pub extern "C" fn v8_fn_ptr #generics (info: *const #core::v8::FunctionCallbackInfo) #where_clause {
+ let info = unsafe { &*info };
+ let scope = &mut unsafe { #core::v8::CallbackScope::new(info) };
+ let args = #core::v8::FunctionCallbackArguments::from_function_callback_info(info);
+ let rv = #core::v8::ReturnValue::from_function_callback_info(info);
+ Self::v8_func::<#type_params>(scope, args, rv);
}
- pub fn decl #generics () -> #core::OpDecl #where_clause {
+ pub const fn decl #generics () -> #core::OpDecl #where_clause {
#core::OpDecl {
name: Self::name(),
- v8_fn_ptr: Self::v8_fn_ptr::<#type_params>(),
+ v8_fn_ptr: Self::v8_fn_ptr::<#type_params> as _,
enabled: true,
fast_fn: #decl,
is_async: #is_async,