File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2628,4 +2628,6 @@ namespace ts {
26282628 export function and < T > ( f : ( arg : T ) => boolean , g : ( arg : T ) => boolean ) {
26292629 return ( arg : T ) => f ( arg ) && g ( arg ) ;
26302630 }
2631+
2632+ export function assertTypeIsNever ( _ : never ) : void { }
26312633}
Original file line number Diff line number Diff line change @@ -722,6 +722,12 @@ namespace ts {
722722 }
723723 break ;
724724
725+ case SyntaxKind . BinaryExpression :
726+ if ( getSpecialPropertyAssignmentKind ( node as BinaryExpression ) !== SpecialPropertyAssignmentKind . None ) {
727+ addDeclaration ( node as BinaryExpression ) ;
728+ }
729+ // falls through
730+
725731 default :
726732 forEachChild ( node , visit ) ;
727733 }
Original file line number Diff line number Diff line change @@ -343,6 +343,28 @@ namespace ts {
343343 return ScriptElementKind . alias ;
344344 case SyntaxKind . JSDocTypedefTag :
345345 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+ }
346368 default :
347369 return ScriptElementKind . unknown ;
348370 }
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