Skip to content

Commit 4065ebf

Browse files
committed
Merge pull request #2107 from Microsoft/destructuring_classElements
do not include constructor parameters with binding patterns as names whe...
2 parents 10298c8 + 11f589f commit 4065ebf

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/services/navigationBar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ module ts.NavigationBar {
423423
});
424424

425425
// Add the constructor parameters in as children of the class (for property parameters).
426-
// Note that *all* parameters will be added to the nodes array, but parameters that
426+
// Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that
427427
// are not properties will be filtered out later by createChildItem.
428428
var nodes: Node[] = removeDynamicallyNamedProperties(node);
429429
if (constructor) {
430-
nodes.push.apply(nodes, constructor.parameters);
430+
nodes.push.apply(nodes, filter(constructor.parameters, p => !isBindingPattern(p.name)));
431431
}
432432

433433
var childItems = getItemsWorker(sortNodes(nodes), createChildItem);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////class A {
4+
//// x: any
5+
//// constructor([a]: any) {
6+
//// }
7+
////}
8+
////class B {
9+
//// x: any;
10+
//// constructor( {a} = { a: 1 }) {
11+
//// }
12+
////}
13+
14+
verify.getScriptLexicalStructureListCount(6); // 2x(class + field + constructor)

0 commit comments

Comments
 (0)