@@ -50,6 +50,7 @@ module ts.NavigationBar {
5050 case SyntaxKind . ArrayBindingPattern :
5151 forEach ( ( < BindingPattern > node ) . elements , visit ) ;
5252 break ;
53+ case SyntaxKind . BindingElement :
5354 case SyntaxKind . VariableDeclaration :
5455 if ( isBindingPattern ( ( < VariableDeclaration > node ) . name ) ) {
5556 visit ( ( < VariableDeclaration > node ) . name ) ;
@@ -262,17 +263,34 @@ module ts.NavigationBar {
262263 return createItem ( node , getTextOfNode ( ( < FunctionLikeDeclaration > node ) . name ) , ts . ScriptElementKind . functionElement ) ;
263264
264265 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 ) ;
267279 }
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 ) ;
270288 }
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 ) ;
273291 }
274292 else {
275- return createItem ( node , getTextOfNode ( ( < VariableDeclaration > node ) . name ) , ts . ScriptElementKind . variableElement ) ;
293+ return createItem ( node , getTextOfNode ( name ) , ts . ScriptElementKind . variableElement ) ;
276294 }
277295
278296 case SyntaxKind . Constructor :
0 commit comments