Skip to content

Commit

Permalink
Fixes #3586 (#3589)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean authored Jan 29, 2021
1 parent 63c1827 commit f727b26
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/less/src/less/tree/dimension.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ Dimension.prototype = Object.assign(new Node(), {
// so `1px + 2` will yield `3px`.
operate(context, op, other) {
/* jshint noempty:false */
let value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
let value = this._operate(context, op, this.value, other.value);
let unit = this.unit.clone();

if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
Expand Down
7 changes: 5 additions & 2 deletions packages/less/src/less/tree/operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ Operation.prototype = Object.assign(new Node(), {
if (b instanceof Dimension && a instanceof Color) {
b = b.toColor();
}
if (!a.operate) {
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
if (!a.operate || !b.operate) {
if (
(a instanceof Operation || b instanceof Operation)
&& a.op === '/' && context.math === MATH.PARENS_DIVISION
) {
return new Operation(this.op, [a, b], this.isSpaced);
}
throw { type: 'Operation',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@var: 16;
@var: 10 + 6;

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

0 comments on commit f727b26

Please sign in to comment.