File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -2628,4 +2628,6 @@ namespace ts {
2628
2628
export function and < T > ( f : ( arg : T ) => boolean , g : ( arg : T ) => boolean ) {
2629
2629
return ( arg : T ) => f ( arg ) && g ( arg ) ;
2630
2630
}
2631
+
2632
+ export function assertTypeIsNever ( _ : never ) : void { }
2631
2633
}
Original file line number Diff line number Diff line change @@ -722,6 +722,12 @@ namespace ts {
722
722
}
723
723
break ;
724
724
725
+ case SyntaxKind . BinaryExpression :
726
+ if ( getSpecialPropertyAssignmentKind ( node as BinaryExpression ) !== SpecialPropertyAssignmentKind . None ) {
727
+ addDeclaration ( node as BinaryExpression ) ;
728
+ }
729
+ // falls through
730
+
725
731
default :
726
732
forEachChild ( node , visit ) ;
727
733
}
Original file line number Diff line number Diff line change @@ -343,6 +343,28 @@ namespace ts {
343
343
return ScriptElementKind . alias ;
344
344
case SyntaxKind . JSDocTypedefTag :
345
345
return ScriptElementKind . typeElement ;
346
+ case SyntaxKind . BinaryExpression :
347
+ const kind = getSpecialPropertyAssignmentKind ( node as BinaryExpression ) ;
348
+ const { right } = node as BinaryExpression ;
349
+ switch ( kind ) {
350
+ case SpecialPropertyAssignmentKind . None :
351
+ return ScriptElementKind . unknown ;
352
+ case SpecialPropertyAssignmentKind . ExportsProperty :
353
+ case SpecialPropertyAssignmentKind . ModuleExports :
354
+ const rightKind = getNodeKind ( right ) ;
355
+ return rightKind === ScriptElementKind . unknown ? ScriptElementKind . constElement : rightKind ;
356
+ case SpecialPropertyAssignmentKind . PrototypeProperty :
357
+ return ScriptElementKind . memberFunctionElement ; // instance method
358
+ case SpecialPropertyAssignmentKind . ThisProperty :
359
+ return ScriptElementKind . memberVariableElement ; // property
360
+ case SpecialPropertyAssignmentKind . Property :
361
+ // static method / property
362
+ return isFunctionExpression ( right ) ? ScriptElementKind . memberFunctionElement : ScriptElementKind . memberVariableElement ;
363
+ default : {
364
+ assertTypeIsNever ( kind ) ;
365
+ return ScriptElementKind . unknown ;
366
+ }
367
+ }
346
368
default :
347
369
return ScriptElementKind . unknown ;
348
370
}
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts"/>
2
+
3
+ // @allowJs : true
4
+ // @Filename : /a.js
5
+ ////exports.{| "name": "x", "kind": "const" |}x = 0;
6
+ ////exports.{| "name": "y", "kind": "function" |}y = function() {};
7
+ ////function Cls() {
8
+ //// this.{| "name": "prop", "kind": "property" |}prop = 0;
9
+ //// }
10
+ ////Cls.{| "name": "staticMethod", "kind": "method" |}staticMethod = function() {};
11
+ ////Cls.{| "name": "staticProperty", "kind": "property" |}staticProperty = 0;
12
+ ////Cls.prototype.{| "name": "instance", "kind": "method" |}instance = function() {};
13
+
14
+ for ( const marker of test . markers ( ) ) {
15
+ verify . navigationItemsListContains (
16
+ marker . data . name ,
17
+ marker . data . kind ,
18
+ marker . data . name ,
19
+ "exact" ) ;
20
+ }
You can’t perform that action at this time.
0 commit comments