about summary refs log tree commit diff
path: root/src/interpreter
diff options
context:
space:
mode:
Diffstat (limited to 'src/interpreter')
-rw-r--r--src/interpreter/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/interpreter/mod.rs b/src/interpreter/mod.rs
index fc1556d1c292..00421ee90dc8 100644
--- a/src/interpreter/mod.rs
+++ b/src/interpreter/mod.rs
@@ -3,7 +3,9 @@ mod value;
 
 pub use self::error::{Error, Result};
 pub use self::value::{Function, Value};
-use crate::ast::{BinaryOperator, Expr, FunctionType, Ident, Literal, Type, UnaryOperator};
+use crate::ast::{
+    BinaryOperator, Binding, Expr, FunctionType, Ident, Literal, Type, UnaryOperator,
+};
 use crate::common::env::Env;
 
 #[derive(Debug, Default)]
@@ -49,9 +51,9 @@ impl<'a> Interpreter<'a> {
             }
             Expr::Let { bindings, body } => {
                 self.env.push();
-                for (id, val) in bindings {
-                    let val = self.eval(val)?;
-                    self.env.set(id, val);
+                for Binding { ident, body, .. } in bindings {
+                    let val = self.eval(body)?;
+                    self.env.set(ident, val);
                 }
                 let res = self.eval(body)?;
                 self.env.pop();
@@ -101,6 +103,7 @@ impl<'a> Interpreter<'a> {
                 args: fun.args.iter().map(|arg| arg.to_owned()).collect(),
                 body: fun.body.to_owned(),
             })),
+            Expr::Ascription { expr, .. } => self.eval(expr),
         }
     }
 }