From 9e393d275320dd00b6c5f39b4c7f6e0286819876 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 12 May 2018 02:20:50 -0700 Subject: [PATCH] Kill old type structure --- schala-lang/src/eval.rs | 4 ++-- schala-lang/src/lib.rs | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/schala-lang/src/eval.rs b/schala-lang/src/eval.rs index 737e145..34763dc 100644 --- a/schala-lang/src/eval.rs +++ b/schala-lang/src/eval.rs @@ -302,7 +302,7 @@ impl Expr { } impl<'a> State<'a> { - pub fn evaluate_new(&mut self, ast: ReducedAST, repl: bool) -> Vec> { + pub fn evaluate(&mut self, ast: ReducedAST, repl: bool) -> Vec> { use ast_reducing::*; let mut acc = vec![]; @@ -440,7 +440,7 @@ mod eval_tests { macro_rules! fresh_env { ($string:expr, $correct:expr) => { let mut state = State::new(); - let all_output = state.evaluate_new(parse(tokenize($string)).0.unwrap().reduce(), true); + let all_output = state.evaluate(parse(tokenize($string)).0.unwrap().reduce(), true); let ref output = all_output[0]; assert_eq!(*output, Ok($correct.to_string())); } diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index 763d8f6..677278c 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -93,17 +93,15 @@ fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi } } -type TempASTReduction = (ast_reducing::ReducedAST, parsing::AST); -fn ast_reducing(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { +fn ast_reducing(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { let output = input.reduce(); comp.map(|comp| comp.add_artifact(TraceArtifact::new("ast_reducing", format!("{:?}", output)))); - Ok((output, input)) + Ok(output) } -fn eval(handle: &mut Schala, input: TempASTReduction, comp: Option<&mut UnfinishedComputation>) -> Result { +fn eval(handle: &mut Schala, input: ast_reducing::ReducedAST, comp: Option<&mut UnfinishedComputation>) -> Result { comp.map(|comp| comp.add_artifact(TraceArtifact::new("value_state", handle.state.debug_print()))); - let new_input = input.0; - let evaluation_outputs = handle.state.evaluate_new(new_input, true); + let evaluation_outputs = handle.state.evaluate(input, true); let text_output: Result, String> = evaluation_outputs .into_iter() .collect();