diff options
Diffstat (limited to 'src/codegen/llvm.rs')
-rw-r--r-- | src/codegen/llvm.rs | 9 |
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), } } |