11( function ( tree ) {
22
3- tree . Rule = function ( name , value , important , merge , index , currentFileInfo , inline ) {
3+ tree . Rule = function ( name , value , important , merge , index , currentFileInfo , inline , variable ) {
44 this . name = name ;
55 this . value = ( value instanceof tree . Value || value instanceof tree . Ruleset ) ? value : new ( tree . Value ) ( [ value ] ) ;
66 this . important = important ? ' ' + important . trim ( ) : '' ;
77 this . merge = merge ;
88 this . index = index ;
99 this . currentFileInfo = currentFileInfo ;
1010 this . inline = inline || false ;
11- this . variable = name . charAt && ( name . charAt ( 0 ) === '@' ) ;
11+ this . variable = ( variable !== undefined ) ? variable
12+ : ( name . charAt && ( name . charAt ( 0 ) === '@' ) ) ;
1213} ;
1314
1415tree . Rule . prototype = {
@@ -30,13 +31,14 @@ tree.Rule.prototype = {
3031 } ,
3132 toCSS : tree . toCSS ,
3233 eval : function ( env ) {
33- var strictMathBypass = false , name = this . name , evaldValue ;
34+ var strictMathBypass = false , name = this . name , variable = this . variable , evaldValue ;
3435 if ( typeof name !== "string" ) {
3536 // expand 'primitive' name directly to get
3637 // things faster (~10% for benchmark.less):
3738 name = ( name . length === 1 )
3839 && ( name [ 0 ] instanceof tree . Keyword )
3940 ? name [ 0 ] . value : evalName ( env , name ) ;
41+ variable = false ; // never treat expanded interpolation as new variable name
4042 }
4143 if ( name === "font" && ! env . strictMath ) {
4244 strictMathBypass = true ;
@@ -54,7 +56,8 @@ tree.Rule.prototype = {
5456 evaldValue ,
5557 this . important ,
5658 this . merge ,
57- this . index , this . currentFileInfo , this . inline ) ;
59+ this . index , this . currentFileInfo , this . inline ,
60+ variable ) ;
5861 }
5962 catch ( e ) {
6063 if ( typeof e . index !== 'number' ) {
0 commit comments