Fix test failures

This commit is contained in:
Andy Hanson 2018-11-06 17:15:52 -08:00
parent ea558ede86
commit c2cdce3cd6
5 changed files with 10 additions and 5 deletions

View file

@ -1379,6 +1379,7 @@ namespace ts {
}
function bindJSDocTypeAlias(node: JSDocTypedefTag | JSDocCallbackTag) {
node.tagName.parent = node;
if (node.fullName) {
setParentPointers(node, node.fullName);
}

View file

@ -6772,7 +6772,7 @@ namespace ts {
// TODO: determine what this does before making it public.
/* @internal */
export function isJSDocTag(node: Node): boolean {
export function isJSDocTag(node: Node): node is JSDocTag {
return node.kind >= SyntaxKind.FirstJSDocTagNode && node.kind <= SyntaxKind.LastJSDocTagNode;
}

View file

@ -84,8 +84,8 @@ namespace ts.codefix {
if (importDecl) {
changes.delete(sourceFile, importDecl);
}
else if (token.kind === SyntaxKind.AtToken && isJSDocTemplateTag(token.parent)) {
changes.delete(sourceFile, token.parent);
else if (isJSDocTemplateTag(token)) {
changes.delete(sourceFile, token);
}
else if (token.kind === SyntaxKind.LessThanToken) {
deleteTypeParameters(changes, sourceFile, token);

View file

@ -1481,7 +1481,7 @@ namespace ts {
function shouldGetType(sourceFile: SourceFile, node: Node, position: number): boolean {
switch (node.kind) {
case SyntaxKind.Identifier:
return !isLabelName(node);
return !isLabelName(node) && !isTagName(node);
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.QualifiedName:
// Don't return quickInfo if inside the comment in `a/**/.b`
@ -2159,7 +2159,7 @@ namespace ts {
function initializeNameTable(sourceFile: SourceFile): void {
const nameTable = sourceFile.nameTable = createUnderscoreEscapedMap<number>();
sourceFile.forEachChild(function walk(node) {
if (isIdentifier(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) {
if (isIdentifier(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) {
const text = getEscapedTextOfIdentifierOrLiteral(node);
nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1);
}

View file

@ -246,6 +246,10 @@ namespace ts {
return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node);
}
export function isTagName(node: Node): boolean {
return isJSDocTag(node.parent) && node.parent.tagName === node;
}
export function isRightSideOfQualifiedName(node: Node) {
return node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node;
}