carto/lib/less/tree/variable.js

20 lines
604 B
JavaScript
Raw Normal View History

if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
tree.Variable = function Variable(name) { this.name = name };
tree.Variable.prototype = {
2010-03-12 04:36:50 +08:00
toCSS: function (env) { return this.eval(env).toCSS(env) },
2010-02-26 06:57:47 +08:00
eval: function (env) {
var variable, v, name = this.name;
2010-02-24 02:39:05 +08:00
if (variable = tree.find(env.frames, function (frame) {
if (v = frame.variables(name)) {
return v.value.eval(env);
}
2010-03-08 12:33:26 +08:00
})) { return variable }
else {
throw new(Error)("variable " + this.name + " is undefined");
2010-02-24 02:39:05 +08:00
}
}
};