Permalink
Browse files

Made Let take a Declaration

  • Loading branch information...
1 parent efb0752 commit 8dff67da5e097d32ec314f477e5819e474d1a9d0 Mikael Bung committed Mar 13, 2010
Showing with 4 additions and 6 deletions.
  1. +4 −6 haskell.ast.js
View
@@ -76,16 +76,14 @@
return body.eval(clos.env.substitute(x, new interpreter.Closure(env, this.arg)));
};
};
- ast.Let = function(pattern, def, expr) {
- expectType(pattern, ast.Pattern);
- expectType(def, ast.Expression);
+ ast.Let = function(declr, expr) {
+ expectType(declr, ast.Declaration);
expectType(expr, ast.Expression);
this.type = "Let";
- this.pattern = pattern;
- this.def = def;
+ this.declr = declr;
this.expr = expr;
this.eval = function(env) {
- return this.expr.eval(env.substitute(this.pattern, new Closure(env, this.def)));
+ return this.expr.eval(env.substitute(this.declr.pattern, new Closure(env, this.declr.expression)));
};
};
ast.Case = function(expr, cases) {

0 comments on commit 8dff67d

Please sign in to comment.