Permalink
Browse files

Just remove ret when formulating new env.

  • Loading branch information...
1 parent 5264f52 commit bbbfbc381043f854cbecf48afb8b6eef74cfbb59 @maryrosecook committed Mar 16, 2013
Showing with 5 additions and 12 deletions.
  1. +5 −12 src/interpreter.js
View
@@ -53,7 +53,7 @@
var value = assignmentValue(valueNode);
var env = assign(env, assignee, value);
- return nreturn(env.ctx);
+ return rmRet(env);
})
.when("type_assignment", function(ast, env) {
@@ -68,7 +68,7 @@
var value = instantiateType(typeFn, typeIdentifier);
var env = assign(env, assignee, value);
- return nreturn(env.ctx);
+ return rmRet(env);
})
.when("list_assignment", function(ast, env) {
@@ -85,7 +85,7 @@
list[operation](item);
var env = assign(env, assignee, currentListEval.val);
- return nreturn(env.ctx);
+ return rmRet(env);
})
.when("invocation", function(ast, env) {
@@ -95,8 +95,8 @@
var param = resolve(interpretAst(Isla.Parser.extract(ast,
"invocation", 1),
env).val, env);
- var returnVal = fn(env, param);
- return nreturn(env.ctx, returnVal);
+ env.ret = fn(env, param);
+ return env;
})
.when("value", function(ast, env) {
@@ -297,14 +297,7 @@
return env;
}
- var nreturn = function(ctx, ret) {
- if(ret === undefined) {
- return { ctx: ctx, ret: null };
- }
- else {
- return { ctx: ctx, ret: ret };
}
- }
exports.Interpreter.resolve = resolve;
exports.Interpreter.evaluateValue = evaluateValue;

0 comments on commit bbbfbc3

Please sign in to comment.