From 65d9bfb53361bfce6dc594c6a9df92c017dea6cb Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sat, 24 Jun 2023 13:54:10 +0200 Subject: refactor(ops): Adding op2 macro and implementing in a couple of places (#19534) This is a new op system that will eventually replace `#[op]`. Features - More maintainable, generally less-coupled code - More modern Rust proc-macro libraries - Enforces correct `fast` labelling for fast ops, allowing for visual scanning of fast ops - Explicit marking of `#[string]`, `#[serde]` and `#[smi]` parameters. This first version of op2 supports integer and Option parameters only, and allows us to start working on converting ops and adding features. --- ops/op2/test_cases/sync/doc_comment.out | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ops/op2/test_cases/sync/doc_comment.out (limited to 'ops/op2/test_cases/sync/doc_comment.out') diff --git a/ops/op2/test_cases/sync/doc_comment.out b/ops/op2/test_cases/sync/doc_comment.out new file mode 100644 index 000000000..bd0d0b21f --- /dev/null +++ b/ops/op2/test_cases/sync/doc_comment.out @@ -0,0 +1,35 @@ +#[allow(non_camel_case_types)] +pub struct op_has_doc_comment {} +impl op_has_doc_comment { + pub const fn name() -> &'static str { + stringify!(op_has_doc_comment) + } + pub const fn decl() -> deno_core::_ops::OpDecl { + deno_core::_ops::OpDecl { + name: stringify!(op_has_doc_comment), + v8_fn_ptr: Self::slow_function as _, + enabled: true, + fast_fn: Some({ + use deno_core::v8::fast_api::Type; + use deno_core::v8::fast_api::CType; + deno_core::v8::fast_api::FastFunction::new( + &[], + CType::Void, + Self::fast_function as *const ::std::ffi::c_void, + ) + }), + is_async: false, + is_unstable: false, + is_v8: false, + arg_count: 0usize as u8, + } + } + pub extern "C" fn slow_function(info: *const deno_core::v8::FunctionCallbackInfo) { + let result = Self::call(); + } + fn fast_function(_: deno_core::v8::Local) -> () { + Self::call() + } + #[inline(always)] + pub fn call() -> () {} +} -- cgit v1.2.3