Don't use nameTable for type keywords, and don't handle keyof.

This commit is contained in:
Andy Hanson 2017-01-20 06:41:57 -08:00
parent 2d232c21a2
commit 1267fd3030
4 changed files with 6 additions and 20 deletions

View file

@ -353,9 +353,7 @@ namespace ts.FindAllReferences {
const references: ReferenceEntry[] = [];
for (const sourceFile of sourceFiles) {
cancellationToken.throwIfCancellationRequested();
if (sourceFileHasName(sourceFile, name)) {
addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references);
}
addReferencesForKeywordInFile(sourceFile, keywordKind, name, cancellationToken, references);
}
return [{ definition, references }];

View file

@ -1975,20 +1975,11 @@ namespace ts {
setNameTable((<LiteralExpression>node).text, node);
}
break;
case SyntaxKind.TypeOperator:
setNameTable(tokenToString((node as ts.TypeOperatorNode).operator), node);
forEachChild(node, walk);
break;
default:
if (isTypeKeyword(node.kind)) {
setNameTable(tokenToString(node.kind), node);
}
else {
forEachChild(node, walk);
if (node.jsDoc) {
for (const jsDoc of node.jsDoc) {
forEachChild(jsDoc, walk);
}
forEachChild(node, walk);
if (node.jsDoc) {
for (const jsDoc of node.jsDoc) {
forEachChild(jsDoc, walk);
}
}
}

View file

@ -1,4 +1,4 @@
// These utilities are common to multiple language service features.
// These utilities are common to multiple language service features.
/* @internal */
namespace ts {
export const scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
@ -1126,7 +1126,6 @@ namespace ts {
case SyntaxKind.BooleanKeyword:
case SyntaxKind.NeverKeyword:
case SyntaxKind.NumberKeyword:
case SyntaxKind.KeyOfKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.StringKeyword:
case SyntaxKind.SymbolKeyword:

View file

@ -21,8 +21,6 @@
////function v(v: [|void|]): [|void|];
////function k(x: [|keyof|] Date): [|keyof|] Date;
// @Filename: b.ts
// const z: [|any|] = 0;