@@ -3,6 +3,8 @@ import Color from './color';
3
3
import Dimension from './dimension' ;
4
4
import * as Constants from '../constants' ;
5
5
import Call from './call' ;
6
+ import CustomProperty from './custom-property' ;
7
+ import Anonymous from './anonymous' ;
6
8
const MATH = Constants . Math ;
7
9
8
10
@@ -38,6 +40,12 @@ Operation.prototype = Object.assign(new Node(), {
38
40
if ( b instanceof Dimension && a instanceof Color ) {
39
41
b = b . toColor ( ) ;
40
42
}
43
+ if ( a instanceof Dimension && b instanceof CustomProperty ) {
44
+ return [ a , new Anonymous ( op ) , b ] ;
45
+ }
46
+ if ( b instanceof Dimension && a instanceof CustomProperty ) {
47
+ return [ a , new Anonymous ( op ) , b ] ;
48
+ }
41
49
if ( ! a . operate || ! b . operate ) {
42
50
if (
43
51
( a instanceof Operation || b instanceof Operation )
@@ -78,7 +86,7 @@ Operation.prototype = Object.assign(new Node(), {
78
86
} ,
79
87
80
88
evalVariable : function ( context , operand ) {
81
- if ( operand . name === 'var' && operand . args . length == = 1 ) {
89
+ if ( operand . name === 'var' && operand . args . length > = 1 ) {
82
90
var varName = operand . args [ 0 ] . toCSS ( ) ;
83
91
var variable = this . find ( context . frames , function ( frame ) {
84
92
var v = frame . variable ( varName ) ;
@@ -92,7 +100,7 @@ Operation.prototype = Object.assign(new Node(), {
92
100
return ( new Call ( '_SELF' , [ v . value ] ) ) . eval ( context ) ;
93
101
}
94
102
else {
95
- return v . value . eval ( context ) ;
103
+ return new CustomProperty ( v . name , operand . args [ 1 ] ? operand . args [ 1 ] . toCSS ( ) : null , 0 , { } ) ;
96
104
}
97
105
}
98
106
} ) ;
0 commit comments