@@ -65,6 +65,9 @@ function convertMathExpression(node, precision) {
65
65
function reduceAddSubExpression ( node , precision ) {
66
66
const { left, right, operator : op } = node
67
67
68
+ if ( left . type === 'CssVariable' || right . type === 'CssVariable' )
69
+ return node
70
+
68
71
// something + 0 => something
69
72
// something - 0 => something
70
73
if ( right . value === 0 )
@@ -125,7 +128,7 @@ function reduceAddSubExpression(node, precision) {
125
128
// (expr) <op> value
126
129
if (
127
130
left . type === 'MathExpression' &&
128
- ( left . operator === '+' || left . operator === '-' ) &&
131
+ ( left . operator === '+' || left . operator === '-' ) &&
129
132
isValueType ( right . type )
130
133
) {
131
134
// (value + something) + value => (value + value) + something
@@ -176,7 +179,7 @@ function reduceAddSubExpression(node, precision) {
176
179
}
177
180
178
181
function reduceDivisionExpression ( node ) {
179
- if ( node . right . type === 'MathExpression' )
182
+ if ( ! isValueType ( node . right . type ) )
180
183
return node
181
184
182
185
if ( node . right . type !== 'Value' )
@@ -188,7 +191,7 @@ function reduceDivisionExpression(node) {
188
191
// (expr) / value
189
192
if ( node . left . type === 'MathExpression' ) {
190
193
if (
191
- isValueType ( node . left . left . type ) &&
194
+ isValueType ( node . left . left . type ) &&
192
195
isValueType ( node . left . right . type )
193
196
) {
194
197
node . left . left . value /= node . right . value
0 commit comments