@@ -50,6 +50,7 @@ module ts.NavigationBar {
50
50
case SyntaxKind . ArrayBindingPattern :
51
51
forEach ( ( < BindingPattern > node ) . elements , visit ) ;
52
52
break ;
53
+ case SyntaxKind . BindingElement :
53
54
case SyntaxKind . VariableDeclaration :
54
55
if ( isBindingPattern ( ( < VariableDeclaration > node ) . name ) ) {
55
56
visit ( ( < VariableDeclaration > node ) . name ) ;
@@ -262,17 +263,34 @@ module ts.NavigationBar {
262
263
return createItem ( node , getTextOfNode ( ( < FunctionLikeDeclaration > node ) . name ) , ts . ScriptElementKind . functionElement ) ;
263
264
264
265
case SyntaxKind . VariableDeclaration :
265
- if ( isBindingPattern ( ( < VariableDeclaration > node ) . name ) ) {
266
- break ;
266
+ case SyntaxKind . BindingElement :
267
+ var variableDeclarationNode : Node ;
268
+ var name : Node ;
269
+
270
+ if ( node . kind === SyntaxKind . BindingElement ) {
271
+ name = ( < BindingElement > node ) . name ;
272
+ variableDeclarationNode = node ;
273
+ // binding elements are added only for variable declarations
274
+ // bubble up to the containing variable declaration
275
+ while ( variableDeclarationNode && variableDeclarationNode . kind !== SyntaxKind . VariableDeclaration ) {
276
+ variableDeclarationNode = variableDeclarationNode . parent ;
277
+ }
278
+ Debug . assert ( variableDeclarationNode !== undefined ) ;
267
279
}
268
- if ( isConst ( node ) ) {
269
- return createItem ( node , getTextOfNode ( ( < VariableDeclaration > node ) . name ) , ts . ScriptElementKind . constElement ) ;
280
+ else {
281
+ Debug . assert ( ! isBindingPattern ( ( < VariableDeclaration > node ) . name ) ) ;
282
+ variableDeclarationNode = node ;
283
+ name = ( < VariableDeclaration > node ) . name ;
284
+ }
285
+
286
+ if ( isConst ( variableDeclarationNode ) ) {
287
+ return createItem ( node , getTextOfNode ( name ) , ts . ScriptElementKind . constElement ) ;
270
288
}
271
- else if ( isLet ( node ) ) {
272
- return createItem ( node , getTextOfNode ( ( < VariableDeclaration > node ) . name ) , ts . ScriptElementKind . letElement ) ;
289
+ else if ( isLet ( variableDeclarationNode ) ) {
290
+ return createItem ( node , getTextOfNode ( name ) , ts . ScriptElementKind . letElement ) ;
273
291
}
274
292
else {
275
- return createItem ( node , getTextOfNode ( ( < VariableDeclaration > node ) . name ) , ts . ScriptElementKind . variableElement ) ;
293
+ return createItem ( node , getTextOfNode ( name ) , ts . ScriptElementKind . variableElement ) ;
276
294
}
277
295
278
296
case SyntaxKind . Constructor :
0 commit comments