about summary refs log tree commit diff
path: root/src/codegen
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2021-03-13T18·12-0500
committerGriffin Smith <root@gws.fyi>2021-03-13T18·12-0500
commitf8beda81fbe8d04883aee71ff4ea078f897c6de4 (patch)
treead61046d7e86c8a71381ee6b936fcd46ec3a89ac /src/codegen
parent3dff189499af1ddd60d8fc128b794d15f1cb19ae (diff)
Allow exprs+bindings to optionally be ascripted
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/codegen/llvm.rs b/src/codegen/llvm.rs
index 1d1c742a9434..1f4a457cd81b 100644
--- a/src/codegen/llvm.rs
+++ b/src/codegen/llvm.rs
@@ -12,7 +12,7 @@ use inkwell::values::{AnyValueEnum, BasicValueEnum, FunctionValue};
 use inkwell::IntPredicate;
 use thiserror::Error;
 
-use crate::ast::{BinaryOperator, Decl, Expr, Fun, Ident, Literal, UnaryOperator};
+use crate::ast::{BinaryOperator, Binding, Decl, Expr, Fun, Ident, Literal, UnaryOperator};
 use crate::common::env::Env;
 
 #[derive(Debug, PartialEq, Eq, Error)]
@@ -137,9 +137,9 @@ impl<'ctx, 'ast> Codegen<'ctx, 'ast> {
             }
             Expr::Let { bindings, body } => {
                 self.env.push();
-                for (id, val) in bindings {
-                    let val = self.codegen_expr(val)?;
-                    self.env.set(id, val);
+                for Binding { ident, body, .. } in bindings {
+                    let val = self.codegen_expr(body)?;
+                    self.env.set(ident, val);
                 }
                 let res = self.codegen_expr(body);
                 self.env.pop();
@@ -207,6 +207,7 @@ impl<'ctx, 'ast> Codegen<'ctx, 'ast> {
                 self.env.restore(env);
                 Ok(function.into())
             }
+            Expr::Ascription { expr, .. } => self.codegen_expr(expr),
         }
     }