1
1
( function ( tree ) {
2
2
3
- tree . Rule = function ( name , value , important , merge , index , currentFileInfo , inline ) {
3
+ tree . Rule = function ( name , value , important , merge , index , currentFileInfo , inline , variable ) {
4
4
this . name = name ;
5
5
this . value = ( value instanceof tree . Value || value instanceof tree . Ruleset ) ? value : new ( tree . Value ) ( [ value ] ) ;
6
6
this . important = important ? ' ' + important . trim ( ) : '' ;
7
7
this . merge = merge ;
8
8
this . index = index ;
9
9
this . currentFileInfo = currentFileInfo ;
10
10
this . inline = inline || false ;
11
- this . variable = name . charAt && ( name . charAt ( 0 ) === '@' ) ;
11
+ this . variable = ( variable !== undefined ) ? variable
12
+ : ( name . charAt && ( name . charAt ( 0 ) === '@' ) ) ;
12
13
} ;
13
14
14
15
tree . Rule . prototype = {
@@ -30,13 +31,14 @@ tree.Rule.prototype = {
30
31
} ,
31
32
toCSS : tree . toCSS ,
32
33
eval : function ( env ) {
33
- var strictMathBypass = false , name = this . name , evaldValue ;
34
+ var strictMathBypass = false , name = this . name , variable = this . variable , evaldValue ;
34
35
if ( typeof name !== "string" ) {
35
36
// expand 'primitive' name directly to get
36
37
// things faster (~10% for benchmark.less):
37
38
name = ( name . length === 1 )
38
39
&& ( name [ 0 ] instanceof tree . Keyword )
39
40
? name [ 0 ] . value : evalName ( env , name ) ;
41
+ variable = false ; // never treat expanded interpolation as new variable name
40
42
}
41
43
if ( name === "font" && ! env . strictMath ) {
42
44
strictMathBypass = true ;
@@ -54,7 +56,8 @@ tree.Rule.prototype = {
54
56
evaldValue ,
55
57
this . important ,
56
58
this . merge ,
57
- this . index , this . currentFileInfo , this . inline ) ;
59
+ this . index , this . currentFileInfo , this . inline ,
60
+ variable ) ;
58
61
}
59
62
catch ( e ) {
60
63
if ( typeof e . index !== 'number' ) {
0 commit comments