2010-03-13 16:34:48 +08:00
|
|
|
if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
|
2010-03-02 04:32:21 +08:00
|
|
|
|
|
|
|
tree.Operation = function Operation(op, operands) {
|
2010-02-24 02:39:05 +08:00
|
|
|
this.op = op.trim();
|
|
|
|
this.operands = operands;
|
|
|
|
};
|
2010-03-02 04:32:21 +08:00
|
|
|
tree.Operation.prototype.eval = function (env) {
|
2010-02-27 11:31:04 +08:00
|
|
|
var a = this.operands[0],
|
|
|
|
b = this.operands[1],
|
|
|
|
temp;
|
|
|
|
|
2010-03-02 04:32:21 +08:00
|
|
|
if (a instanceof tree.Dimension) {
|
2010-02-27 11:31:04 +08:00
|
|
|
temp = b, b = a, a = temp;
|
|
|
|
}
|
|
|
|
return a.eval(env).operate(this.op, b.eval(env));
|
2010-02-24 02:39:05 +08:00
|
|
|
};
|
|
|
|
|