code style change in variable.js

This commit is contained in:
cloudhead 2010-02-25 17:57:47 -05:00
parent 3b53bb8707
commit 6e22c810d0

View File

@ -1,19 +1,21 @@
node.Variable = function Variable(name) { this.name = name };
node.Variable.prototype.eval = function (env) {
var variables, variable;
for (var i = 0; i < env.frames.length; i++) {
variables = env.frames[i].variables();
node.Variable.prototype = {
eval: function (env) {
var variables, variable;
for (var i = 0; i < env.frames.length; i++) {
variables = env.frames[i].variables();
for (var j = 0; j < variables.length; j++) {
variable = variables[j];
for (var j = 0; j < variables.length; j++) {
variable = variables[j];
if (variable.name === this.name) {
if (variable.value.eval) {
return variable.value.eval(env);
} else { return variable.value }
if (variable.name === this.name) {
if (variable.value.eval) {
return variable.value.eval(env);
} else { return variable.value }
}
}
}
throw new(Error)("variable " + this.name + " is undefined");
}
throw new(Error)("variable " + this.name + " is undefined");
};