diff options
| author | Matt Mastracci <matthew@mastracci.com> | 2023-06-24 23:30:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-24 15:30:04 -0600 |
| commit | a181ceb0e3791c842db6e8e6f528cf9ce320642a (patch) | |
| tree | 0714537d8b91013f9253e65202e2dc596e977d01 /ops/op2/test_cases/sync/result_void.out | |
| parent | 4a18c761351dccb146973793cf22e6efffff18bf (diff) | |
refactor(ops): op2 supports Result in slow call path (#19602)
Diffstat (limited to 'ops/op2/test_cases/sync/result_void.out')
| -rw-r--r-- | ops/op2/test_cases/sync/result_void.out | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ops/op2/test_cases/sync/result_void.out b/ops/op2/test_cases/sync/result_void.out new file mode 100644 index 000000000..74c0c66a6 --- /dev/null +++ b/ops/op2/test_cases/sync/result_void.out @@ -0,0 +1,45 @@ +#[allow(non_camel_case_types)] +pub struct op_void_with_result {} +impl op_void_with_result { + pub const fn name() -> &'static str { + stringify!(op_void_with_result) + } + pub const fn decl() -> deno_core::_ops::OpDecl { + deno_core::_ops::OpDecl { + name: stringify!(op_void_with_result), + v8_fn_ptr: Self::slow_function as _, + enabled: true, + fast_fn: None, + 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(); + match result { + Ok(result) => {} + Err(err) => { + let scope = &mut unsafe { deno_core::v8::CallbackScope::new(&*info) }; + let args = deno_core::v8::FunctionCallbackArguments::from_function_callback_info(unsafe { + &*info + }); + let opctx = unsafe { + &*(deno_core::v8::Local::<deno_core::v8::External>::cast(args.data()) + .value() as *const deno_core::_ops::OpCtx) + }; + let opstate = ::std::cell::RefCell::borrow(&*opctx.state); + let exception = deno_core::error::to_v8_error( + scope, + opstate.get_error_class_fn, + &err, + ); + scope.throw_exception(exception); + return; + } + }; + } + #[inline(always)] + pub fn call() -> Result<(), AnyError> {} +} |
