From 1d1a5fb6fce278a97ca22454109aaf7aa428dd48 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 29 Apr 2018 21:04:57 -0700 Subject: [PATCH] Pass mutable handle to unfinishedcomputation --- schala-lang/src/lib.rs | 10 +++++----- schala-repl/src/language.rs | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index 7c690c5..8cb6f25 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -40,22 +40,22 @@ impl Schala { } } -fn tokenizing_stage(_handle: &mut Schala, input: &str) -> Result, ()> { +fn tokenizing_stage(_handle: &mut Schala, input: &str, comp: Option<&mut UnfinishedComputation>) -> Result, ()> { Ok(tokenizing::tokenize(input)) } -fn parsing_stage(_handle: &mut Schala, input: Vec) -> Result { +fn parsing_stage(_handle: &mut Schala, input: Vec, comp: Option<&mut UnfinishedComputation>) -> Result { parsing::parse(input).0 } -fn symbol_table_stage(handle: &mut Schala, input: parsing::AST) -> Result { +fn symbol_table_stage(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { match handle.type_context.add_top_level_types(&input) { Ok(()) => Ok(input), Err(msg) => Err(msg) } } -fn typechecking_stage(handle: &mut Schala, input: parsing::AST) -> Result { +fn typechecking_stage(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { match handle.type_context.type_check_ast(&input) { Ok(ty) => { println!("FINAL TYPE: {:?}", ty); @@ -70,7 +70,7 @@ fn typechecking_stage(handle: &mut Schala, input: parsing::AST) -> Result Result { +fn eval_stage(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { let evaluation_outputs = handle.state.evaluate(input); let text_output: Result, String> = evaluation_outputs .into_iter() diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index 88df780..72d6986 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -208,7 +208,8 @@ macro_rules! pass_chain_helper { { let pass_name = stringify!($pass); println!("Running pass {}", pass_name); - let output = $pass($state, $input); + let debug_pointer: Option<&mut UnfinishedComputation> = None; + let output = $pass($state, $input, debug_pointer); match output { Ok(result) => pass_chain_helper! { $state, $comp; result $(, $rest)* }, Err(err) => {