@@ -25,6 +25,7 @@ module.exports = {
2525 var result = { baseName : propertyName , prefixLength : 0 } ;
2626
2727 this . _prefixesList . some ( function ( prefix ) {
28+ // TODO: Why don't we store prefixes with `-`?
2829 prefix = '-' + prefix + '-' ;
2930 if ( propertyName . indexOf ( prefix ) !== 0 ) return ;
3031 result = {
@@ -65,6 +66,7 @@ module.exports = {
6566 */
6667 _getDeclName : function ( node ) {
6768 if ( node [ 0 ] !== 'declaration' ) return ;
69+ // TODO: Check that it's not a variable
6870 return node [ 1 ] [ 1 ] [ 1 ] ;
6971 } ,
7072
@@ -81,12 +83,13 @@ module.exports = {
8183 * @returns {String|undefined }
8284 */
8385 _getValName : function ( node ) {
84- if ( node [ 0 ] !== 'declaration' || ! node [ 2 ] || ! node [ 2 ] [ 2 ] )
86+ // TODO: Check that `node[3]` is the node we need
87+ if ( node [ 0 ] !== 'declaration' || ! node [ 3 ] || ! node [ 3 ] )
8588 return ;
86- if ( node [ 2 ] [ 2 ] [ 0 ] === 'ident' )
87- return node [ 2 ] [ 2 ] [ 1 ] ;
88- if ( node [ 2 ] [ 2 ] [ 0 ] === 'funktion ' )
89- return node [ 2 ] [ 2 ] [ 1 ] [ 1 ] ;
89+ if ( node [ 3 ] [ 2 ] [ 0 ] === 'ident' )
90+ return node [ 3 ] [ 2 ] [ 1 ] ;
91+ if ( node [ 3 ] [ 2 ] [ 0 ] === 'function ' )
92+ return node [ 3 ] [ 2 ] [ 1 ] [ 1 ] ;
9093 } ,
9194
9295 /**
@@ -156,16 +159,15 @@ module.exports = {
156159 _this . _updateDict ( info , dict , node [ i - 1 ] [ 1 ] ) ;
157160 } ) ;
158161 this . _walk ( node , this . _getValName , function ( info , i ) {
159- _this . _updateDict ( info , dict , node [ i ] [ 2 ] [ 1 ] [ 1 ] ) ;
162+ _this . _updateDict ( info , dict , node [ i ] [ 3 ] [ 1 ] [ 1 ] ) ;
160163 } ) ;
161164
162165 // Update nodes
163166 this . _walk ( node , this . _getDeclName , function ( info , i ) {
164167 node [ i - 1 ] [ 1 ] = _this . _updateIndent ( info , dict , node [ i - 1 ] [ 1 ] ) ;
165168 } ) ;
166169 this . _walk ( node , this . _getValName , function ( info , i ) {
167- node [ i ] [ 2 ] [ 1 ] [ 1 ] = _this . _updateIndent ( info , dict , node [ i ] [ 2 ] [ 1 ] [ 1 ] ) ;
170+ node [ i ] [ 3 ] [ 1 ] [ 1 ] = _this . _updateIndent ( info , dict , node [ i ] [ 3 ] [ 1 ] [ 1 ] ) ;
168171 } ) ;
169172 }
170-
171173} ;
0 commit comments