mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
Arbitrary (non-falsey) values returned from functions are cast as Anonymous nodes
This commit is contained in:
@@ -48,10 +48,16 @@ Call.prototype.eval = function (context) {
|
||||
}
|
||||
|
||||
if (result !== null && result !== undefined) {
|
||||
// All returned results must be Nodes,
|
||||
// so anything other than a Node is a null Node
|
||||
// Results that that are not nodes are cast as Anonymous nodes
|
||||
// Falsy values or booleans are returned as empty nodes
|
||||
if (!(result instanceof Node)) {
|
||||
result = new Anonymous(null);
|
||||
if (!result || result === true) {
|
||||
result = new Anonymous(null);
|
||||
}
|
||||
else {
|
||||
result = new Anonymous(result.toString());
|
||||
}
|
||||
|
||||
}
|
||||
result._index = this._index;
|
||||
result._fileInfo = this._fileInfo;
|
||||
|
||||
Reference in New Issue
Block a user