carto/lib/less/tree/operation.js

18 lines
446 B
JavaScript

if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
tree.Operation = function Operation(op, operands) {
this.op = op.trim();
this.operands = operands;
};
tree.Operation.prototype.eval = function (env) {
var a = this.operands[0],
b = this.operands[1],
temp;
if (a instanceof tree.Dimension) {
temp = b, b = a, a = temp;
}
return a.eval(env).operate(this.op, b.eval(env));
};