diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-10-11 11:41:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 11:41:54 -0700 |
commit | 97d8498d46bbfb7bb16eeb3a69565d2aeda1e5aa (patch) | |
tree | cfe85f3afccda5c0f87cbb29b79e0eab8d9c0d97 /cli/ops/errors.rs | |
parent | 04ed8d0531b7c2c308b28b742f5c332345d97065 (diff) |
Add init methods for each op module (#3087)
Diffstat (limited to 'cli/ops/errors.rs')
-rw-r--r-- | cli/ops/errors.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cli/ops/errors.rs b/cli/ops/errors.rs index cd21a3880..2d786b97d 100644 --- a/cli/ops/errors.rs +++ b/cli/ops/errors.rs @@ -1,18 +1,30 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use super::dispatch_json::{Deserialize, JsonOp, Value}; use crate::fmt_errors::JSError; +use crate::ops::json_op; use crate::source_maps::get_orig_position; use crate::source_maps::CachedMaps; use crate::state::ThreadSafeState; use deno::*; use std::collections::HashMap; +pub fn init(i: &mut Isolate, s: &ThreadSafeState) { + i.register_op( + "apply_source_map", + s.core_op(json_op(s.stateful_op(op_apply_source_map))), + ); + i.register_op( + "format_error", + s.core_op(json_op(s.stateful_op(op_format_error))), + ); +} + #[derive(Deserialize)] struct FormatErrorArgs { error: String, } -pub fn op_format_error( +fn op_format_error( state: &ThreadSafeState, args: Value, _zero_copy: Option<PinnedBuf>, @@ -32,7 +44,7 @@ struct ApplySourceMap { column: i32, } -pub fn op_apply_source_map( +fn op_apply_source_map( state: &ThreadSafeState, args: Value, _zero_copy: Option<PinnedBuf>, |