getJSDocHost always returns a defined result (#24255)

This commit is contained in:
Andy 2018-05-18 13:20:13 -07:00 committed by GitHub
parent d60866aada
commit 7f0258bcb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View file

@ -2172,8 +2172,7 @@ namespace ts {
return;
}
const host = getJSDocHost(node);
if (host &&
isExpressionStatement(host) &&
if (isExpressionStatement(host) &&
isBinaryExpression(host.expression) &&
getSpecialPropertyAssignmentKind(host.expression) === SpecialPropertyAssignmentKind.PrototypeProperty) {
const symbol = getSymbolOfNode(host.expression.left);

View file

@ -1927,11 +1927,7 @@ namespace ts {
}
export function getJSDocHost(node: Node): HasJSDoc {
const comment = findAncestor(node.parent,
node => !(isJSDocNode(node) || node.flags & NodeFlags.JSDoc) ? "quit" : node.kind === SyntaxKind.JSDocComment);
if (comment) {
return (comment as JSDoc).parent;
}
return Debug.assertDefined(findAncestor(node.parent, isJSDoc)).parent;
}
export function getTypeParameterFromJsDoc(node: TypeParameterDeclaration & { parent: JSDocTemplateTag }): TypeParameterDeclaration | undefined {