2
2
namespace ts . SymbolDisplay {
3
3
// TODO(drosen): use contextual SemanticMeaning.
4
4
export function getSymbolKind ( typeChecker : TypeChecker , symbol : Symbol , location : Node ) : string {
5
- const flags = symbol . getFlags ( ) ;
5
+ const { flags } = symbol ;
6
6
7
7
if ( flags & SymbolFlags . Class ) return getDeclarationOfKind ( symbol , SyntaxKind . ClassExpression ) ?
8
8
ScriptElementKind . localClassElement : ScriptElementKind . classElement ;
@@ -11,18 +11,18 @@ namespace ts.SymbolDisplay {
11
11
if ( flags & SymbolFlags . Interface ) return ScriptElementKind . interfaceElement ;
12
12
if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
13
13
14
- const result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker , symbol , flags , location ) ;
14
+ const result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker , symbol , location ) ;
15
15
if ( result === ScriptElementKind . unknown ) {
16
16
if ( flags & SymbolFlags . TypeParameter ) return ScriptElementKind . typeParameterElement ;
17
- if ( flags & SymbolFlags . EnumMember ) return ScriptElementKind . variableElement ;
17
+ if ( flags & SymbolFlags . EnumMember ) return ScriptElementKind . enumMemberElement ;
18
18
if ( flags & SymbolFlags . Alias ) return ScriptElementKind . alias ;
19
19
if ( flags & SymbolFlags . Module ) return ScriptElementKind . moduleElement ;
20
20
}
21
21
22
22
return result ;
23
23
}
24
24
25
- function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker : TypeChecker , symbol : Symbol , flags : SymbolFlags , location : Node ) {
25
+ function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker : TypeChecker , symbol : Symbol , location : Node ) {
26
26
if ( typeChecker . isUndefinedSymbol ( symbol ) ) {
27
27
return ScriptElementKind . variableElement ;
28
28
}
@@ -32,6 +32,7 @@ namespace ts.SymbolDisplay {
32
32
if ( location . kind === SyntaxKind . ThisKeyword && isExpression ( location ) ) {
33
33
return ScriptElementKind . parameterElement ;
34
34
}
35
+ const { flags } = symbol ;
35
36
if ( flags & SymbolFlags . Variable ) {
36
37
if ( isFirstDeclarationOfSymbolParameter ( symbol ) ) {
37
38
return ScriptElementKind . parameterElement ;
@@ -93,7 +94,7 @@ namespace ts.SymbolDisplay {
93
94
const displayParts : SymbolDisplayPart [ ] = [ ] ;
94
95
let documentation : SymbolDisplayPart [ ] ;
95
96
const symbolFlags = symbol . flags ;
96
- let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker , symbol , symbolFlags , location ) ;
97
+ let symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar ( typeChecker , symbol , location ) ;
97
98
let hasAddedSymbolInfo : boolean ;
98
99
const isThisExpression = location . kind === SyntaxKind . ThisKeyword && isExpression ( location ) ;
99
100
let type : Type ;
@@ -319,6 +320,7 @@ namespace ts.SymbolDisplay {
319
320
}
320
321
}
321
322
if ( symbolFlags & SymbolFlags . EnumMember ) {
323
+ symbolKind = ScriptElementKind . enumMemberElement ;
322
324
addPrefixForAnyFunctionOrVar ( symbol , "enum member" ) ;
323
325
const declaration = symbol . declarations [ 0 ] ;
324
326
if ( declaration . kind === SyntaxKind . EnumMember ) {
0 commit comments