From ba4185b0fb0c985e8c407a82ab80e21fed124259 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 20 May 2018 20:58:56 -0700 Subject: [PATCH] Back to including typechecking code in pipeline --- schala-lang/src/lib.rs | 5 +---- schala-lang/src/typechecking.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index f47340b..389c7ad 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -89,8 +89,7 @@ fn symbol_table(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi } fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { - /* - match handle.type_context.borrow_mut().type_check_ast(&input) { + match handle.type_context.type_check_ast(&input) { Ok(ty) => { comp.map(|comp| comp.add_artifact(TraceArtifact::new("type_check", format!("{:?}", ty)))); Ok(input) @@ -100,8 +99,6 @@ fn typechecking(handle: &mut Schala, input: parsing::AST, comp: Option<&mut Unfi Ok(input) } } - */ - Ok(input) } fn ast_reducing(_handle: &mut Schala, input: parsing::AST, comp: Option<&mut UnfinishedComputation>) -> Result { diff --git a/schala-lang/src/typechecking.rs b/schala-lang/src/typechecking.rs index 5f02773..64fb071 100644 --- a/schala-lang/src/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -139,6 +139,15 @@ impl TypeEnvironment { } } +impl TypeContext { + pub fn type_check_ast(&mut self, ast: &parsing::AST) -> TypeResult { + Ok(format!("SUCKA")) + } +} + + + + /* TODO this should just check the name against a map, and that map should be pre-populated with * types */ /*