From 0049d4e50c9dd945f25f69b08b08fbf492001f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 4 Nov 2019 16:38:52 +0100 Subject: Refactor Worker and ThreadSafeState (#3242) * Split ThreadSafeState into State and GlobalState. State is a "local" state belonging to "Worker" while "GlobalState" is state shared by whole program. * Update "Worker" and ops to use "GlobalState" where applicable * Move and refactor "WorkerChannels" resource --- cli/ops/compiler.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cli/ops/compiler.rs') diff --git a/cli/ops/compiler.rs b/cli/ops/compiler.rs index 720eb65fc..e7d38f364 100644 --- a/cli/ops/compiler.rs +++ b/cli/ops/compiler.rs @@ -4,6 +4,7 @@ use crate::futures::future::join_all; use crate::futures::Future; use crate::ops::json_op; use crate::state::ThreadSafeState; +use deno::Loader; use deno::*; pub fn init(i: &mut Isolate, s: &ThreadSafeState) { @@ -36,7 +37,7 @@ fn op_cache( let module_specifier = ModuleSpecifier::resolve_url(&args.module_id) .expect("Should be valid module specifier"); - state.ts_compiler.cache_compiler_output( + state.global_state.ts_compiler.cache_compiler_output( &module_specifier, &args.extension, &args.contents, @@ -67,6 +68,7 @@ fn op_fetch_source_files( let resolved_specifier = state.resolve(specifier, &args.referrer, false, is_dyn_import)?; let fut = state + .global_state .file_fetcher .fetch_source_file_async(&resolved_specifier); futures.push(fut); -- cgit v1.2.3