@@ -7,12 +7,13 @@ var Declaration = function (name, value, important, merge, index, currentFileInf
77 this . value = ( value instanceof Node ) ? value : new Value ( [ value ] ) ; //value instanceof tree.Value || value instanceof tree.Ruleset ??
88 this . important = important ? ' ' + important . trim ( ) : '' ;
99 this . merge = merge ;
10- this . index = index ;
11- this . currentFileInfo = currentFileInfo ;
10+ this . _index = index ;
11+ this . _fileInfo = currentFileInfo ;
1212 this . inline = inline || false ;
1313 this . variable = ( variable !== undefined ) ? variable
1414 : ( name . charAt && ( name . charAt ( 0 ) === '@' ) ) ;
1515 this . allowRoot = true ;
16+ this . setParent ( this . value , this ) ;
1617} ;
1718
1819function evalName ( context , name ) {
@@ -27,16 +28,16 @@ function evalName(context, name) {
2728Declaration . prototype = new Node ( ) ;
2829Declaration . prototype . type = "Declaration" ;
2930Declaration . prototype . genCSS = function ( context , output ) {
30- output . add ( this . name + ( context . compress ? ':' : ': ' ) , this . currentFileInfo , this . index ) ;
31+ output . add ( this . name + ( context . compress ? ':' : ': ' ) , this . fileInfo ( ) , this . getIndex ( ) ) ;
3132 try {
3233 this . value . genCSS ( context , output ) ;
3334 }
3435 catch ( e ) {
35- e . index = this . index ;
36- e . filename = this . currentFileInfo . filename ;
36+ e . index = this . _index ;
37+ e . filename = this . _fileInfo . filename ;
3738 throw e ;
3839 }
39- output . add ( this . important + ( ( this . inline || ( context . lastRule && context . compress ) ) ? "" : ";" ) , this . currentFileInfo , this . index ) ;
40+ output . add ( this . important + ( ( this . inline || ( context . lastRule && context . compress ) ) ? "" : ";" ) , this . _fileInfo , this . _index ) ;
4041} ;
4142Declaration . prototype . eval = function ( context ) {
4243 var strictMathBypass = false , name = this . name , evaldValue , variable = this . variable ;
@@ -57,7 +58,7 @@ Declaration.prototype.eval = function (context) {
5758
5859 if ( ! this . variable && evaldValue . type === "DetachedRuleset" ) {
5960 throw { message : "Rulesets cannot be evaluated on a property." ,
60- index : this . index , filename : this . currentFileInfo . filename } ;
61+ index : this . getIndex ( ) , filename : this . fileInfo ( ) . filename } ;
6162 }
6263 var important = this . important ,
6364 importantResult = context . importantScope . pop ( ) ;
@@ -69,13 +70,13 @@ Declaration.prototype.eval = function (context) {
6970 evaldValue ,
7071 important ,
7172 this . merge ,
72- this . index , this . currentFileInfo , this . inline ,
73+ this . getIndex ( ) , this . fileInfo ( ) , this . inline ,
7374 variable ) ;
7475 }
7576 catch ( e ) {
7677 if ( typeof e . index !== 'number' ) {
77- e . index = this . index ;
78- e . filename = this . currentFileInfo . filename ;
78+ e . index = this . getIndex ( ) ;
79+ e . filename = this . fileInfo ( ) . filename ;
7980 }
8081 throw e ;
8182 }
@@ -90,7 +91,7 @@ Declaration.prototype.makeImportant = function () {
9091 this . value ,
9192 "!important" ,
9293 this . merge ,
93- this . index , this . currentFileInfo , this . inline ) ;
94+ this . getIndex ( ) , this . fileInfo ( ) , this . inline ) ;
9495} ;
9596
9697module . exports = Declaration ;
0 commit comments