Sha256: 777edf1e89c94dba467c897a7d61a4f9399fca3b955f74c65178e83bb71e50db
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
(function (tree) { // // A function call node. // tree.Call = function (name, args, index, filename) { this.name = name; this.args = args; this.index = index; this.filename = filename; }; tree.Call.prototype = { // // When evaluating a function call, // we either find the function in `tree.functions` [1], // in which case we call it, passing the evaluated arguments, // if this returns null or we cannot find the function, we // simply print it out as it appeared originally [2]. // // The *functions.js* file contains the built-in functions. // // The reason why we evaluate the arguments, is in the case where // we try to pass a variable to a function, like: `saturate(@color)`. // The function should receive the value, not the variable. // eval: function (env) { var args = this.args.map(function (a) { return a.eval(env) }), result; if (this.name in tree.functions) { // 1. try { result = tree.functions[this.name].apply(tree.functions, args); if (result != null) { return result; } } catch (e) { throw { type: e.type || "Runtime", message: "error evaluating function `" + this.name + "`" + (e.message ? ': ' + e.message : ''), index: this.index, filename: this.filename }; } } // 2. return new(tree.Anonymous)(this.name + "(" + args.map(function (a) { return a.toCSS(env) }).join(', ') + ")"); }, toCSS: function (env) { return this.eval(env).toCSS(); } }; })(require('../tree'));
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
less-2.3.3 | lib/less/js/lib/less/tree/call.js |
less-2.3.2 | lib/less/js/lib/less/tree/call.js |
less-2.3.1 | lib/less/js/lib/less/tree/call.js |