@@ -39,13 +39,14 @@ namespace ts {
3939 case SyntaxKind . TypeLiteral :
4040 return SemanticMeaning . Type ;
4141
42+ case SyntaxKind . JSDocTypedefTag :
43+ // If it has no name node, it shares the name with the value declaration below it.
44+ return ( node as JSDocTypedefTag ) . name === undefined ? SemanticMeaning . Value | SemanticMeaning . Type : SemanticMeaning . Type ;
45+
4246 case SyntaxKind . EnumMember :
4347 case SyntaxKind . ClassDeclaration :
4448 return SemanticMeaning . Value | SemanticMeaning . Type ;
4549
46- case SyntaxKind . EnumDeclaration :
47- return SemanticMeaning . All ;
48-
4950 case SyntaxKind . ModuleDeclaration :
5051 if ( isAmbientModule ( < ModuleDeclaration > node ) ) {
5152 return SemanticMeaning . Namespace | SemanticMeaning . Value ;
@@ -57,6 +58,7 @@ namespace ts {
5758 return SemanticMeaning . Namespace ;
5859 }
5960
61+ case SyntaxKind . EnumDeclaration :
6062 case SyntaxKind . NamedImports :
6163 case SyntaxKind . ImportSpecifier :
6264 case SyntaxKind . ImportEqualsDeclaration :
@@ -70,15 +72,15 @@ namespace ts {
7072 return SemanticMeaning . Namespace | SemanticMeaning . Value ;
7173 }
7274
73- return SemanticMeaning . Value | SemanticMeaning . Type | SemanticMeaning . Namespace ;
75+ return SemanticMeaning . All ;
7476 }
7577
7678 export function getMeaningFromLocation ( node : Node ) : SemanticMeaning {
7779 if ( node . kind === SyntaxKind . SourceFile ) {
7880 return SemanticMeaning . Value ;
7981 }
8082 else if ( node . parent . kind === SyntaxKind . ExportAssignment ) {
81- return SemanticMeaning . Value | SemanticMeaning . Type | SemanticMeaning . Namespace ;
83+ return SemanticMeaning . All ;
8284 }
8385 else if ( isInRightSideOfImport ( node ) ) {
8486 return getMeaningFromRightHandSideOfImportEquals ( node ) ;
@@ -162,10 +164,22 @@ namespace ts {
162164 node = node . parent ;
163165 }
164166
165- return node . parent . kind === SyntaxKind . TypeReference ||
166- ( node . parent . kind === SyntaxKind . ExpressionWithTypeArguments && ! isExpressionWithTypeArgumentsInClassExtendsClause ( < ExpressionWithTypeArguments > node . parent ) ) ||
167- ( node . kind === SyntaxKind . ThisKeyword && ! isPartOfExpression ( node ) ) ||
168- node . kind === SyntaxKind . ThisType ;
167+ switch ( node . kind ) {
168+ case SyntaxKind . ThisKeyword :
169+ return ! isPartOfExpression ( node ) ;
170+ case SyntaxKind . ThisType :
171+ return true ;
172+ }
173+
174+ switch ( node . parent . kind ) {
175+ case SyntaxKind . TypeReference :
176+ case SyntaxKind . JSDocTypeReference :
177+ return true ;
178+ case SyntaxKind . ExpressionWithTypeArguments :
179+ return ! isExpressionWithTypeArgumentsInClassExtendsClause ( < ExpressionWithTypeArguments > node . parent ) ;
180+ }
181+
182+ return false ;
169183 }
170184
171185 export function isCallExpressionTarget ( node : Node ) : boolean {
0 commit comments