Support services for @typedef (#16087)

* Support services for @typedef

* Ensure JSDocTypeReference has SemanticMeaning.Type

* Get SemanticMeaning right
This commit is contained in:
Andy
2017-05-26 09:52:46 -07:00
committed by GitHub
parent 6972766e91
commit 3cd9f3d2d4
8 changed files with 97 additions and 11 deletions

View File

@@ -2102,6 +2102,7 @@ namespace ts {
}
export interface JSDocTag extends Node {
parent: JSDoc;
atToken: AtToken;
tagName: Identifier;
comment: string | undefined;
@@ -2132,6 +2133,7 @@ namespace ts {
}
export interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
parent: JSDoc;
kind: SyntaxKind.JSDocTypedefTag;
fullName?: JSDocNamespaceDeclaration | Identifier;
name?: Identifier;
@@ -2140,6 +2142,7 @@ namespace ts {
}
export interface JSDocPropertyTag extends JSDocTag, TypeElement {
parent: JSDoc;
kind: SyntaxKind.JSDocPropertyTag;
name: Identifier;
typeExpression: JSDocTypeExpression;

View File

@@ -288,6 +288,14 @@ namespace ts {
return node.kind >= SyntaxKind.FirstJSDocNode && node.kind <= SyntaxKind.LastJSDocNode;
}
export function isJSDoc(node: Node): node is JSDoc {
return node.kind === SyntaxKind.JSDocComment;
}
export function isJSDocTypedefTag(node: Node): node is JSDocTypedefTag {
return node.kind === SyntaxKind.JSDocTypedefTag;
}
export function isJSDocTag(node: Node) {
return node.kind >= SyntaxKind.FirstJSDocTagNode && node.kind <= SyntaxKind.LastJSDocTagNode;
}
@@ -1551,6 +1559,10 @@ namespace ts {
}
export function getJSDocs(node: Node): (JSDoc | JSDocTag)[] {
if (isJSDocTypedefTag(node)) {
return [node.parent];
}
let cache: (JSDoc | JSDocTag)[] = node.jsDocCache;
if (!cache) {
getJSDocsWorker(node);