carto/lib/less/tree/variable.js
2010-06-19 01:51:26 -04:00

21 lines
570 B
JavaScript

(function (tree) {
tree.Variable = function (name, index) { this.name = name, this.index = index };
tree.Variable.prototype = {
eval: function (env) {
var variable, v, name = this.name;
if (variable = tree.find(env.frames, function (frame) {
if (v = frame.variable(name)) {
return v.value.eval(env);
}
})) { return variable }
else {
throw { message: "variable " + this.name + " is undefined",
index: this.index };
}
}
};
})(require('less/tree'));