File tree Expand file tree Collapse file tree 4 files changed +18
-116
lines changed
Expand file tree Collapse file tree 4 files changed +18
-116
lines changed Original file line number Diff line number Diff line change 11// This Source Code Form is subject to the terms of the Mozilla Public
22// License, v. 2.0. If a copy of the MPL was not distributed with this
33// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4- mod repl;
5- mod repl_theme;
6-
74use andromeda_core:: { Runtime , RuntimeConfig } ;
85use clap:: { Parser as ClapParser , Subcommand } ;
9- use repl:: repl;
10-
116/// A JavaScript runtime
127#[ derive( Debug , ClapParser ) ]
138#[ command( name = "andromeda" ) ]
@@ -34,12 +29,6 @@ enum Command {
3429 #[ arg( required = true ) ]
3530 paths : Vec < String > ,
3631 } ,
37-
38- /// Runs the REPL
39- Repl {
40- #[ arg( short, long) ]
41- verbose : bool ,
42- } ,
4332}
4433
4534fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
@@ -82,9 +71,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
8271 }
8372 }
8473 }
85- Command :: Repl { verbose } => {
86- repl ( verbose) ;
87- }
8874 } ) ;
8975
9076 rt. block_on ( nova_thread)
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -148,22 +148,26 @@ impl Runtime {
148148 break ;
149149 }
150150
151- // Listen for pending macro tasks and resolve one by one
152- #[ allow( clippy:: single_match) ]
153- match self . macro_task_rx . recv ( ) {
154- Ok ( MacroTask :: ResolvePromise ( root_value) ) => {
155- let value = root_value. take ( & mut self . agent ) ;
156- if let Value :: Promise ( promise) = value {
157- let promise_capability = PromiseCapability :: from_promise ( promise, false ) ;
158- promise_capability. resolve ( & mut self . agent , Value :: Undefined ) ;
159- } else {
160- panic ! ( "Attempted to resolve a non-promise value" ) ;
161- }
162- }
163- _ => { }
164- }
151+ self . handle_macro_task ( ) ;
165152 }
166153
167154 Ok ( final_result)
168155 }
156+
157+ // Listen for pending macro tasks and resolve one by one
158+ pub fn handle_macro_task ( & mut self ) {
159+ #[ allow( clippy:: single_match) ]
160+ match self . macro_task_rx . recv ( ) {
161+ Ok ( MacroTask :: ResolvePromise ( root_value) ) => {
162+ let value = root_value. take ( & mut self . agent ) ;
163+ if let Value :: Promise ( promise) = value {
164+ let promise_capability = PromiseCapability :: from_promise ( promise, false ) ;
165+ promise_capability. resolve ( & mut self . agent , Value :: Undefined ) ;
166+ } else {
167+ panic ! ( "Attempted to resolve a non-promise value" ) ;
168+ }
169+ }
170+ _ => { }
171+ }
172+ }
169173}
You can’t perform that action at this time.
0 commit comments