From 0f27b84a5caa10d9056b7a4f9eace3771f8ea114 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 21 Oct 2022 19:35:23 +0530 Subject: chore(core): remove `core.opSync` (#16379) This patch removes the last uses of `core.opSync` from Deno. The new and JIT-friendly way to call sync ops is `core.ops.op_name()`. --- core/01_core.js | 5 ----- core/README.md | 6 +++--- core/lib.deno_core.d.ts | 6 ------ 3 files changed, 3 insertions(+), 14 deletions(-) (limited to 'core') diff --git a/core/01_core.js b/core/01_core.js index b98e54160..04f0eba77 100644 --- a/core/01_core.js +++ b/core/01_core.js @@ -186,10 +186,6 @@ return p; } - function opSync(opName, ...args) { - return ops[opName](...args); - } - function refOp(promiseId) { if (!hasPromise(promiseId)) { return; @@ -307,7 +303,6 @@ // Extra Deno.core.* exports const core = ObjectAssign(globalThis.Deno.core, { opAsync, - opSync, resources, metrics, registerErrorBuilder, diff --git a/core/README.md b/core/README.md index 08ac072cf..df0db5de3 100644 --- a/core/README.md +++ b/core/README.md @@ -17,9 +17,9 @@ responsibility to drive that loop by using `JsRuntime::run_event_loop` method - it must be executed in the context of Rust's future executor (eg. tokio, smol). Rust functions can be registered in JavaScript using `deno_core::Extension`. Use -the `Deno.core.opSync()` and `Deno.core.opAsync()` functions to trigger the op -function callback. A conventional way to write ops is using the -[`deno_ops`](https://github.com/denoland/deno/blob/main/ops) crate. +the `Deno.core.ops.op_name()` and `Deno.core.opAsync("op_name", ...)` functions +to trigger the op function callback. A conventional way to write ops is using +the [`deno_ops`](https://github.com/denoland/deno/blob/main/ops) crate. Documentation for this crate is thin at the moment. Please see [hello_world.rs](https://github.com/denoland/deno/blob/main/core/examples/hello_world.rs) diff --git a/core/lib.deno_core.d.ts b/core/lib.deno_core.d.ts index 2a3764730..6de3bed4b 100644 --- a/core/lib.deno_core.d.ts +++ b/core/lib.deno_core.d.ts @@ -7,12 +7,6 @@ declare namespace Deno { namespace core { - /** Call an op in Rust, and synchronously receive the result. */ - function opSync( - opName: string, - ...args: any[] - ): any; - /** Call an op in Rust, and asynchronously receive the result. */ function opAsync( opName: string, -- cgit v1.2.3