summaryrefslogtreecommitdiff
path: root/cli/ops/errors.rs
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2020-09-06 02:34:02 +0200
committerGitHub <noreply@github.com>2020-09-06 02:34:02 +0200
commitc821e8f2f1fb8ad5e9eb00854277cafc8c80b2f5 (patch)
treec429a3c2707a4047fb512443a8468b7e15e5730d /cli/ops/errors.rs
parent849431eb1d112d1f79f4a327830dc1a5bf22dd47 (diff)
Move JSON ops to deno_core (#7336)
Diffstat (limited to 'cli/ops/errors.rs')
-rw-r--r--cli/ops/errors.rs23
1 files changed, 7 insertions, 16 deletions
diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs
index 558f9af2a..a4f4665e2 100644
--- a/cli/ops/errors.rs
+++ b/cli/ops/errors.rs
@@ -1,27 +1,20 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use super::dispatch_json::{Deserialize, Value};
+
use crate::diagnostics::Diagnostic;
use crate::source_maps::get_orig_position;
use crate::source_maps::CachedMaps;
use crate::state::State;
-use deno_core::CoreIsolate;
use deno_core::ErrBox;
-use deno_core::ResourceTable;
+use deno_core::OpRegistry;
use deno_core::ZeroCopyBuf;
+use serde_derive::Deserialize;
+use serde_json::Value;
use std::collections::HashMap;
use std::rc::Rc;
-pub fn init(i: &mut CoreIsolate, s: &Rc<State>) {
- let t = &CoreIsolate::state(i).borrow().resource_table.clone();
-
- i.register_op(
- "op_apply_source_map",
- s.stateful_json_op_sync(t, op_apply_source_map),
- );
- i.register_op(
- "op_format_diagnostic",
- s.stateful_json_op_sync(t, op_format_diagnostic),
- );
+pub fn init(s: &Rc<State>) {
+ s.register_op_json_sync("op_apply_source_map", op_apply_source_map);
+ s.register_op_json_sync("op_format_diagnostic", op_format_diagnostic);
}
#[derive(Deserialize)]
@@ -34,7 +27,6 @@ struct ApplySourceMap {
fn op_apply_source_map(
state: &State,
- _resource_table: &mut ResourceTable,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, ErrBox> {
@@ -59,7 +51,6 @@ fn op_apply_source_map(
fn op_format_diagnostic(
_state: &State,
- _resource_table: &mut ResourceTable,
args: Value,
_zero_copy: &mut [ZeroCopyBuf],
) -> Result<Value, ErrBox> {