From 7c2e7c660804afca823d60e6496aa853f75db16c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 10 Sep 2020 09:57:45 -0400 Subject: Use gotham-like state for ops (#7385) Provides a concrete state type that can be dynamically added. This is necessary for op crates. * renames BasicState to OpState * async ops take `Rc>` * sync ops take `&mut OpState` * removes `OpRegistry`, `OpRouter` traits * `get_error_class_fn` moved to OpState * ResourceTable moved to OpState --- cli/build.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cli/build.rs') diff --git a/cli/build.rs b/cli/build.rs index 422bc1759..f2abb9529 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -3,9 +3,7 @@ mod op_fetch_asset; use deno_core::js_check; -use deno_core::BasicState; use deno_core::JsRuntime; -use deno_core::OpRegistry; use deno_core::StartupData; use std::collections::HashMap; use std::env; @@ -39,8 +37,7 @@ fn create_snapshot( } fn create_runtime_snapshot(snapshot_path: &Path, files: Vec) { - let state = BasicState::new(); - let isolate = JsRuntime::new(state, StartupData::None, true); + let isolate = JsRuntime::new(StartupData::None, true); create_snapshot(isolate, snapshot_path, files); } @@ -73,13 +70,11 @@ fn create_compiler_snapshot( cwd.join("dts/lib.deno.unstable.d.ts"), ); - let state = BasicState::new(); - state.register_op( + let mut isolate = JsRuntime::new(StartupData::None, true); + isolate.register_op( "op_fetch_asset", op_fetch_asset::op_fetch_asset(custom_libs), ); - - let isolate = JsRuntime::new(state, StartupData::None, true); create_snapshot(isolate, snapshot_path, files); } -- cgit v1.2.3