From d4b05dd89e94ed1bba5b24c683da0a895f2ce597 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 29 May 2020 17:41:39 -0400 Subject: refactor: Split isolate and state using safe get_slot() (#5929) --- cli/state.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'cli/state.rs') diff --git a/cli/state.rs b/cli/state.rs index a15d113c8..77a268fab 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -65,7 +65,7 @@ impl State { pub fn stateful_json_op( &self, dispatcher: D, - ) -> impl Fn(&mut deno_core::CoreIsolate, &[u8], Option) -> Op + ) -> impl Fn(&mut deno_core::CoreIsolateState, &[u8], Option) -> Op where D: Fn(&State, Value, Option) -> Result, { @@ -76,10 +76,10 @@ impl State { pub fn stateful_json_op2( &self, dispatcher: D, - ) -> impl Fn(&mut deno_core::CoreIsolate, &[u8], Option) -> Op + ) -> impl Fn(&mut deno_core::CoreIsolateState, &[u8], Option) -> Op where D: Fn( - &mut deno_core::CoreIsolate, + &mut deno_core::CoreIsolateState, &State, Value, Option, @@ -95,13 +95,13 @@ impl State { pub fn core_op( &self, dispatcher: D, - ) -> impl Fn(&mut deno_core::CoreIsolate, &[u8], Option) -> Op + ) -> impl Fn(&mut deno_core::CoreIsolateState, &[u8], Option) -> Op where - D: Fn(&mut deno_core::CoreIsolate, &[u8], Option) -> Op, + D: Fn(&mut deno_core::CoreIsolateState, &[u8], Option) -> Op, { let state = self.clone(); - move |isolate: &mut deno_core::CoreIsolate, + move |isolate_state: &mut deno_core::CoreIsolateState, control: &[u8], zero_copy: Option| -> Op { @@ -109,7 +109,7 @@ impl State { let bytes_sent_zero_copy = zero_copy.as_ref().map(|b| b.len()).unwrap_or(0) as u64; - let op = dispatcher(isolate, control, zero_copy); + let op = dispatcher(isolate_state, control, zero_copy); match op { Op::Sync(buf) => { @@ -155,10 +155,10 @@ impl State { pub fn stateful_minimal_op2( &self, dispatcher: D, - ) -> impl Fn(&mut deno_core::CoreIsolate, &[u8], Option) -> Op + ) -> impl Fn(&mut deno_core::CoreIsolateState, &[u8], Option) -> Op where D: Fn( - &mut deno_core::CoreIsolate, + &mut deno_core::CoreIsolateState, &State, bool, i32, @@ -167,12 +167,12 @@ impl State { { let state = self.clone(); self.core_op(crate::ops::minimal_op( - move |isolate: &mut deno_core::CoreIsolate, + move |isolate_state: &mut deno_core::CoreIsolateState, is_sync: bool, rid: i32, zero_copy: Option| -> MinimalOp { - dispatcher(isolate, &state, is_sync, rid, zero_copy) + dispatcher(isolate_state, &state, is_sync, rid, zero_copy) }, )) } @@ -186,7 +186,7 @@ impl State { &self, dispatcher: D, ) -> impl Fn( - &mut deno_core::CoreIsolate, + &mut deno_core::CoreIsolateState, Value, Option, ) -> Result @@ -194,7 +194,7 @@ impl State { D: Fn(&State, Value, Option) -> Result, { let state = self.clone(); - move |_isolate: &mut deno_core::CoreIsolate, + move |_isolate_state: &mut deno_core::CoreIsolateState, args: Value, zero_copy: Option| -> Result { dispatcher(&state, args, zero_copy) } @@ -204,24 +204,24 @@ impl State { &self, dispatcher: D, ) -> impl Fn( - &mut deno_core::CoreIsolate, + &mut deno_core::CoreIsolateState, Value, Option, ) -> Result where D: Fn( - &mut deno_core::CoreIsolate, + &mut deno_core::CoreIsolateState, &State, Value, Option, ) -> Result, { let state = self.clone(); - move |isolate: &mut deno_core::CoreIsolate, + move |isolate_state: &mut deno_core::CoreIsolateState, args: Value, zero_copy: Option| -> Result { - dispatcher(isolate, &state, args, zero_copy) + dispatcher(isolate_state, &state, args, zero_copy) } } -- cgit v1.2.3