carto/lib/less/node/variable.js
cloudhead 5ee0209e8a don't use Usage: node [options] script.js [arguments]
-v, --version      print node's version
  --debug[=port]     enable remote debugging via given TCP port
  --debug-brk[=port] as above, but break in node.js and
                     wait for remote debugger to connect
  --cflags           print pre-processor and compiler flags
  --v8-options       print v8 command line options

Documentation can be found at http://nodejs.org/api.html or with 'man node', as it's, um, used by node. Use  instead. Also moved tree.node requires in tree.js
2010-03-01 15:32:21 -05:00

24 lines
806 B
JavaScript

if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', '..', 'less', 'tree')); }
tree.Variable = function Variable(name) { this.name = name };
tree.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];
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");
}
};