From 6012bd10873addc845d937f79323b52363b05a8f Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 19 Feb 2019 21:41:07 -0800 Subject: [PATCH] Variables --- schala-lang/language/src/typechecking.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/schala-lang/language/src/typechecking.rs b/schala-lang/language/src/typechecking.rs index 49ba798..08803a8 100644 --- a/schala-lang/language/src/typechecking.rs +++ b/schala-lang/language/src/typechecking.rs @@ -208,7 +208,15 @@ impl<'a> TypeContext<'a> { } } - fn decl(&mut self, _decl: &Declaration) -> InferResult { + fn decl(&mut self, decl: &Declaration) -> InferResult { + use self::Declaration::*; + match decl { + Binding { name, expr, .. } => { + let ty = self.expr(expr)?; + self.variable_map.insert(name.clone(), ty); + }, + _ => (), + } Ok(ty!(Unit)) }