From ab84cd0647719a468e4bd6f7b911a094fe7c685d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Fri, 18 Nov 2016 15:03:40 -0800 Subject: [PATCH] Improve readability of types and names --- src/compiler/checker.ts | 2 +- src/compiler/types.ts | 2 +- src/compiler/utilities.ts | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 0803814bc14..94bbd8823e9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4854,7 +4854,7 @@ namespace ts { if (node.type && node.type.kind === SyntaxKind.JSDocOptionalType) { return true; } - const paramTags = getJSDocParameterTag(node); + const paramTags = getJSDocParameterTags(node); if (paramTags) { for (const paramTag of paramTags) { if (paramTag.isBracketed) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8b648000273..51805228e48 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -498,7 +498,7 @@ namespace ts { /* @internal */ original?: Node; // The original node if this is an updated node. /* @internal */ startsOnNewLine?: boolean; // Whether a synthesized node should start on a new line (used by transforms). /* @internal */ jsDocComments?: JSDoc[]; // JSDoc for the node, if it has any. - /* @internal */ jsDocCache?: (JSDoc | JSDocParameterTag)[]; // JSDoc for the node, plus JSDoc retrieved from its parents + /* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // JSDoc for the node, plus JSDoc and tags retrieved from its parents /* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding) /* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding) /* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e5fd8b067b0..08eaa8033ae 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1427,7 +1427,7 @@ namespace ts { for (const doc of docs) { if (doc.kind === SyntaxKind.JSDocParameterTag) { if (doc.kind === kind) { - result.push(doc as JSDocParameterTag); + result.push(doc as JSDocTag); } } else { @@ -1442,8 +1442,8 @@ namespace ts { return node && firstOrUndefined(getJSDocTags(node, kind)); } - function getJSDocs(node: Node): (JSDoc | JSDocParameterTag)[] { - let cache: (JSDoc | JSDocParameterTag)[] = node.jsDocCache; + function getJSDocs(node: Node): (JSDoc | JSDocTag)[] { + let cache: (JSDoc | JSDocTag)[] = node.jsDocCache; if (!cache) { getJSDocsWorker(node); node.jsDocCache = cache; @@ -1491,7 +1491,7 @@ namespace ts { // Pull parameter comments from declaring function as well if (node.kind === SyntaxKind.Parameter) { - cache = concatenate(cache, getJSDocParameterTag(node)); + cache = concatenate(cache, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { @@ -1502,7 +1502,7 @@ namespace ts { } } - export function getJSDocParameterTag(param: Node): JSDocParameterTag[] { + export function getJSDocParameterTags(param: Node): JSDocParameterTag[] { if (!isParameter(param)) { return undefined; } @@ -1530,7 +1530,7 @@ namespace ts { export function getJSDocType(node: Node): JSDocType { let tag: JSDocTypeTag | JSDocParameterTag = getFirstJSDocTag(node, SyntaxKind.JSDocTypeTag) as JSDocTypeTag; if (!tag && node.kind === SyntaxKind.Parameter) { - const paramTags = getJSDocParameterTag(node); + const paramTags = getJSDocParameterTags(node); if (paramTags) { tag = find(paramTags, tag => !!tag.typeExpression); } @@ -1558,7 +1558,7 @@ namespace ts { export function isRestParameter(node: ParameterDeclaration) { if (node && (node.flags & NodeFlags.JavaScriptFile)) { if (node.type && node.type.kind === SyntaxKind.JSDocVariadicType || - forEach(getJSDocParameterTag(node), + forEach(getJSDocParameterTags(node), t => t.typeExpression && t.typeExpression.type.kind === SyntaxKind.JSDocVariadicType)) { return true; }