diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-08-18 18:30:13 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2020-08-19 02:01:48 +0200 |
commit | 27f4aeb92469660fdd78a89a7b2902c08a23ca4a (patch) | |
tree | e2076aaf31f0708e5037f46d3750f93b0d637417 /cli/ops/repl.rs | |
parent | de1007fc6a2a6c2909732dcb87a5af6c1e370b09 (diff) |
Make Rc/Arc wrapper around State/GlobalState visible (#7104)
Diffstat (limited to 'cli/ops/repl.rs')
-rw-r--r-- | cli/ops/repl.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/ops/repl.rs b/cli/ops/repl.rs index b8fd7ab8b..88b7de881 100644 --- a/cli/ops/repl.rs +++ b/cli/ops/repl.rs @@ -7,10 +7,11 @@ use crate::state::State; use deno_core::CoreIsolate; use deno_core::CoreIsolateState; use deno_core::ZeroCopyBuf; +use std::rc::Rc; use std::sync::Arc; use std::sync::Mutex; -pub fn init(i: &mut CoreIsolate, s: &State) { +pub fn init(i: &mut CoreIsolate, s: &Rc<State>) { i.register_op("op_repl_start", s.stateful_json_op2(op_repl_start)); i.register_op("op_repl_readline", s.stateful_json_op2(op_repl_readline)); } @@ -25,14 +26,14 @@ struct ReplStartArgs { fn op_repl_start( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { let args: ReplStartArgs = serde_json::from_value(args)?; debug!("op_repl_start {}", args.history_file); let history_path = - repl::history_path(&state.borrow().global_state.dir, &args.history_file); + repl::history_path(&state.global_state.dir, &args.history_file); let repl = repl::Repl::new(history_path); let resource = ReplResource(Arc::new(Mutex::new(repl))); let mut resource_table = isolate_state.resource_table.borrow_mut(); @@ -48,7 +49,7 @@ struct ReplReadlineArgs { fn op_repl_readline( isolate_state: &mut CoreIsolateState, - _state: &State, + _state: &Rc<State>, args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { |