From e152dae006c941abd614cc31820981c629410d7c Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 5 Jun 2019 16:35:38 -0400 Subject: RecursiveLoad shouldn't own the Isolate (#2453) This patch makes it so that RecursiveLoad doesn't own the Isolate, so Worker::execute_mod_async does not consume itself. Previously Worker implemented Loader, but now ThreadSafeState does. This is necessary preparation work for dynamic import (#1789) and import maps (#1921) --- cli/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cli/main.rs') diff --git a/cli/main.rs b/cli/main.rs index 953e01943..891f18f39 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -92,10 +92,9 @@ where } } -// TODO(ry) Move this to main.rs pub fn print_file_info(worker: &Worker, url: &str) { let maybe_out = - worker::fetch_module_meta_data_and_maybe_compile(&worker.state, url, "."); + state::fetch_module_meta_data_and_maybe_compile(&worker.state, url, "."); if let Err(err) = maybe_out { println!("{}", err); return; @@ -126,7 +125,8 @@ pub fn print_file_info(worker: &Worker, url: &str) { ); } - if let Some(deps) = worker.modules.deps(&out.module_name) { + let modules = worker.modules.lock().unwrap(); + if let Some(deps) = modules.deps(&out.module_name) { println!("{}{}", ansi::bold("deps:\n".to_string()), deps.name); if let Some(ref depsdeps) = deps.deps { for d in depsdeps { @@ -193,7 +193,7 @@ fn fetch_or_info_command( worker .execute_mod_async(&main_url, true) - .and_then(move |worker| { + .and_then(move |()| { if print_info { print_file_info(&worker, &main_module); } @@ -201,7 +201,7 @@ fn fetch_or_info_command( js_check(result); Ok(()) }) - }).map_err(|(err, _worker)| print_err_and_exit(err)) + }).map_err(print_err_and_exit) }); tokio_util::run(main_future); } @@ -289,12 +289,12 @@ fn run_script(flags: DenoFlags, argv: Vec) { worker .execute_mod_async(&main_url, false) - .and_then(move |worker| { + .and_then(move |()| { worker.then(|result| { js_check(result); Ok(()) }) - }).map_err(|(err, _worker)| print_err_and_exit(err)) + }).map_err(print_err_and_exit) }); tokio_util::run(main_future); } -- cgit v1.2.3