From 46b1c653c0c433932908b7610f60b409af134c76 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 12 Apr 2021 21:55:05 +0200 Subject: refactor(deno): remove concept of bin & json ops (#10145) --- cli/ops/errors.rs | 4 ++-- cli/ops/mod.rs | 12 ++++++------ cli/ops/runtime_compiler.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cli/ops') diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index 5dc4026f7..b3591b6f9 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -15,8 +15,8 @@ use std::collections::HashMap; use std::sync::Arc; pub fn init(rt: &mut deno_core::JsRuntime) { - super::reg_json_sync(rt, "op_apply_source_map", op_apply_source_map); - super::reg_json_sync(rt, "op_format_diagnostic", op_format_diagnostic); + super::reg_sync(rt, "op_apply_source_map", op_apply_source_map); + super::reg_sync(rt, "op_format_diagnostic", op_format_diagnostic); } #[derive(Deserialize)] diff --git a/cli/ops/mod.rs b/cli/ops/mod.rs index 782b0a201..8caede260 100644 --- a/cli/ops/mod.rs +++ b/cli/ops/mod.rs @@ -4,8 +4,8 @@ pub mod errors; pub mod runtime_compiler; use deno_core::error::AnyError; -use deno_core::json_op_async; -use deno_core::json_op_sync; +use deno_core::op_async; +use deno_core::op_sync; use deno_core::serde_json::Value; use deno_core::JsRuntime; use deno_core::OpState; @@ -15,18 +15,18 @@ use std::cell::RefCell; use std::future::Future; use std::rc::Rc; -pub fn reg_json_async(rt: &mut JsRuntime, name: &'static str, op_fn: F) +pub fn reg_async(rt: &mut JsRuntime, name: &'static str, op_fn: F) where F: Fn(Rc>, Value, Option) -> R + 'static, R: Future> + 'static, { - rt.register_op(name, metrics_op(name, json_op_async(op_fn))); + rt.register_op(name, metrics_op(name, op_async(op_fn))); } -pub fn reg_json_sync(rt: &mut JsRuntime, name: &'static str, op_fn: F) +pub fn reg_sync(rt: &mut JsRuntime, name: &'static str, op_fn: F) where F: Fn(&mut OpState, Value, Option) -> Result + 'static, { - rt.register_op(name, metrics_op(name, json_op_sync(op_fn))); + rt.register_op(name, metrics_op(name, op_sync(op_fn))); } diff --git a/cli/ops/runtime_compiler.rs b/cli/ops/runtime_compiler.rs index acd307f2f..dc9cd2163 100644 --- a/cli/ops/runtime_compiler.rs +++ b/cli/ops/runtime_compiler.rs @@ -28,7 +28,7 @@ use std::sync::Arc; use std::sync::Mutex; pub fn init(rt: &mut deno_core::JsRuntime) { - super::reg_json_async(rt, "op_emit", op_emit); + super::reg_async(rt, "op_emit", op_emit); } #[derive(Debug, Deserialize)] -- cgit v1.2.3