diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-06-05 16:35:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 16:35:38 -0400 |
commit | e152dae006c941abd614cc31820981c629410d7c (patch) | |
tree | 503ef96b8e2d34c58765a504ecd2b1ee38bb9eac /cli/main.rs | |
parent | 6fa4d2e7597e2b581a95b6c503cb4c0859f1cefa (diff) |
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)
Diffstat (limited to 'cli/main.rs')
-rw-r--r-- | cli/main.rs | 14 |
1 files changed, 7 insertions, 7 deletions
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<String>) { 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); } |