Gabriel Hurley 6f990c9ce4 Readding bin dir which was mistakenly deleted.
Change-Id: Ia8989da47a55f7c932115a976b6d799714b8dc56
2012-10-12 15:35:19 -07:00

24 lines
622 B
JavaScript

(function (tree) {
tree.Expression = function (value) { this.value = value };
tree.Expression.prototype = {
eval: function (env) {
if (this.value.length > 1) {
return new(tree.Expression)(this.value.map(function (e) {
return e.eval(env);
}));
} else if (this.value.length === 1) {
return this.value[0].eval(env);
} else {
return this;
}
},
toCSS: function (env) {
return this.value.map(function (e) {
return e.toCSS ? e.toCSS(env) : '';
}).join(' ');
}
};
})(require('../tree'));