Skip to content

Commit 2b69eea

Browse files
committed
Fixes less#3586
1 parent 3c23217 commit 2b69eea

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/less/src/less/tree/dimension.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Dimension.prototype = Object.assign(new Node(), {
6666
// so `1px + 2` will yield `3px`.
6767
operate(context, op, other) {
6868
/* jshint noempty:false */
69-
let value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
69+
let value = this._operate(context, op, this.value, other.value);
70+
let unit = this.unit.clone();
7071

7172
if (op === '+' || op === '-') {
7273
if (unit.numerator.length === 0 && unit.denominator.length === 0) {

packages/less/src/less/tree/operation.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ Operation.prototype = Object.assign(new Node(), {
2929
if (b instanceof Dimension && a instanceof Color) {
3030
b = b.toColor();
3131
}
32-
if (!a.operate) {
33-
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
32+
if (!a.operate || !b.operate) {
33+
if (
34+
(a instanceof Operation || b instanceof Operation)
35+
&& a.op === '/' && context.math === MATH.PARENS_DIVISION
36+
) {
3437
return new Operation(this.op, [a, b], this.isSpaced);
3538
}
3639
throw { type: 'Operation',

packages/test-data/less/math/parens-division/media-math.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@var: 16;
1+
@var: 10 + 6;
22

33
@media (min-width: @var + 1) {
44
.foo { bar: 1; }

0 commit comments

Comments
 (0)