Files
less.js/lib/less/tree/anonymous.js
2014-08-14 17:27:16 +01:00

39 lines
1014 B
JavaScript

module.exports = function (tree) {
var Anonymous = function (value, index, currentFileInfo, mapLines, rulesetLike) {
this.value = value;
this.index = index;
this.mapLines = mapLines;
this.currentFileInfo = currentFileInfo;
this.rulesetLike = (typeof rulesetLike === 'undefined')? false : rulesetLike;
};
Anonymous.prototype = {
type: "Anonymous",
eval: function () {
return new Anonymous(this.value, this.index, this.currentFileInfo, this.mapLines, this.rulesetLike);
},
compare: function (x) {
if (!x.toCSS) {
return -1;
}
var left = this.toCSS(),
right = x.toCSS();
if (left === right) {
return 0;
}
return left < right ? -1 : 1;
},
isRulesetLike: function() {
return this.rulesetLike;
},
genCSS: function (env, output) {
output.add(this.value, this.currentFileInfo, this.index, this.mapLines);
},
toCSS: tree.toCSS
};
return Anonymous;
};