mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-23 07:07:09 -05:00
Respond to PR comments
This commit is contained in:
@@ -14,7 +14,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export namespace codefix {
|
||||
const codeFixes = new NumberMap<number, CodeFix[]>();
|
||||
const codeFixes = createMap<number, CodeFix[]>();
|
||||
|
||||
export function registerCodeFix(action: CodeFix) {
|
||||
forEach(action.errorCodes, error => {
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace ts.Completions {
|
||||
|
||||
function getCompletionEntriesFromSymbols(symbols: Symbol[], entries: CompletionEntry[], location: Node, performCharacterChecks: boolean): Set<string> {
|
||||
const start = timestamp();
|
||||
const uniqueNames = new StringSet();
|
||||
const uniqueNames = createSet();
|
||||
if (symbols) {
|
||||
for (const symbol of symbols) {
|
||||
const entry = createCompletionEntry(symbol, location, performCharacterChecks);
|
||||
@@ -363,7 +363,7 @@ namespace ts.Completions {
|
||||
*
|
||||
* both foo.ts and foo.tsx become foo
|
||||
*/
|
||||
const foundFiles = new StringSet();
|
||||
const foundFiles = createSet();
|
||||
for (let filePath of files) {
|
||||
filePath = normalizePath(filePath);
|
||||
if (exclude && comparePaths(filePath, exclude, scriptPath, ignoreCase) === Comparison.EqualTo) {
|
||||
@@ -1553,7 +1553,7 @@ namespace ts.Completions {
|
||||
* do not occur at the current position and have not otherwise been typed.
|
||||
*/
|
||||
function filterNamedImportOrExportCompletionItems(exportsOfModule: Symbol[], namedImportsOrExports: ImportOrExportSpecifier[]): Symbol[] {
|
||||
const existingImportsOrExports = new StringSet();
|
||||
const existingImportsOrExports = createSet();
|
||||
|
||||
for (const element of namedImportsOrExports) {
|
||||
// If this is the current item we are editing right now, do not filter it out
|
||||
@@ -1583,7 +1583,7 @@ namespace ts.Completions {
|
||||
return contextualMemberSymbols;
|
||||
}
|
||||
|
||||
const existingMemberNames = new StringSet();
|
||||
const existingMemberNames = createSet();
|
||||
for (const m of existingMembers) {
|
||||
// Ignore omitted expressions for missing members
|
||||
if (m.kind !== SyntaxKind.PropertyAssignment &&
|
||||
@@ -1628,7 +1628,7 @@ namespace ts.Completions {
|
||||
* do not occur at the current position and have not otherwise been typed.
|
||||
*/
|
||||
function filterJsxAttributes(symbols: Symbol[], attributes: NodeArray<JsxAttribute | JsxSpreadAttribute>): Symbol[] {
|
||||
const seenNames = new StringSet();
|
||||
const seenNames = createSet();
|
||||
for (const attr of attributes) {
|
||||
// If this is the current item we are editing right now, do not filter it out
|
||||
if (attr.getStart() <= position && position <= attr.getEnd()) {
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace ts.DocumentHighlights {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const fileNameToDocumentHighlights = new StringMap<DocumentHighlights>();
|
||||
const fileNameToDocumentHighlights = createMap<string, DocumentHighlights>();
|
||||
const result: DocumentHighlights[] = [];
|
||||
for (const referencedSymbol of referencedSymbols) {
|
||||
for (const referenceEntry of referencedSymbol.references) {
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace ts {
|
||||
export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry {
|
||||
// Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have
|
||||
// for those settings.
|
||||
const buckets = new StringMap<FileMap<DocumentRegistryEntry>>();
|
||||
const buckets = createMap<string, FileMap<DocumentRegistryEntry>>();
|
||||
const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
|
||||
|
||||
function getKeyForCompilationSettings(settings: CompilerOptions): DocumentRegistryBucketKey {
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace ts.FindAllReferences {
|
||||
const possiblePositions = getPossibleSymbolReferencePositions(sourceFile, searchText, start, container.getEnd());
|
||||
|
||||
const parents = getParentSymbolsOfPropertyAccess();
|
||||
const inheritsFromCache = new StringMap<boolean>();
|
||||
const inheritsFromCache = createMap<string, boolean>();
|
||||
|
||||
if (possiblePositions.length) {
|
||||
// Build the set of symbols to search for, initially it has only the current symbol
|
||||
@@ -1047,7 +1047,7 @@ namespace ts.FindAllReferences {
|
||||
|
||||
// Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions
|
||||
if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ new StringMap<Symbol>());
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap<string, Symbol>());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1177,7 +1177,7 @@ namespace ts.FindAllReferences {
|
||||
}
|
||||
|
||||
const result: Symbol[] = [];
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ new StringMap<Symbol>());
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ createMap<string, Symbol>());
|
||||
return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace ts.JsTyping {
|
||||
// that we are confident require typings
|
||||
let safeList: Map<string, string>;
|
||||
|
||||
const EmptySafeList = new StringMap<string>();
|
||||
const EmptySafeList = createMap<string, string>();
|
||||
|
||||
/* @internal */
|
||||
export const nodeCoreModuleList: ReadonlyArray<string> = [
|
||||
@@ -62,7 +62,7 @@ namespace ts.JsTyping {
|
||||
{ cachedTypingPaths: string[], newTypingNames: string[], filesToWatch: string[] } {
|
||||
|
||||
// A typing name to typing file path mapping
|
||||
const inferredTypings = new StringMap<string | undefined>();
|
||||
const inferredTypings = createMap<string, string | undefined>();
|
||||
|
||||
if (!typingOptions || !typingOptions.enableAutoDiscovery) {
|
||||
return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] };
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace ts.NavigationBar {
|
||||
|
||||
/** Merge declarations of the same kind. */
|
||||
function mergeChildren(children: NavigationBarNode[]): void {
|
||||
const nameToItems = new StringMap<NavigationBarNode | NavigationBarNode[]>();
|
||||
const nameToItems = createMap<string, NavigationBarNode | NavigationBarNode[]>();
|
||||
filterMutate(children, child => {
|
||||
const decl = <Declaration>child.node;
|
||||
const name = decl.name && nodeText(decl.name);
|
||||
@@ -626,15 +626,15 @@ namespace ts.NavigationBar {
|
||||
|
||||
/**
|
||||
* Matches all whitespace characters in a string. Eg:
|
||||
*
|
||||
*
|
||||
* "app.
|
||||
*
|
||||
*
|
||||
* onactivated"
|
||||
*
|
||||
*
|
||||
* matches because of the newline, whereas
|
||||
*
|
||||
*
|
||||
* "app.onactivated"
|
||||
*
|
||||
*
|
||||
* does not match.
|
||||
*/
|
||||
const whiteSpaceRegex = /\s+/g;
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace ts {
|
||||
// we see the name of a module that is used everywhere, or the name of an overload). As
|
||||
// such, we cache the information we compute about the candidate for the life of this
|
||||
// pattern matcher so we don't have to compute it multiple times.
|
||||
const stringToWordSpans = new StringMap<TextSpan[]>();
|
||||
const stringToWordSpans = createMap<string, TextSpan[]>();
|
||||
|
||||
pattern = pattern.trim();
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
private computeNamedDeclarations(): Map<string, Declaration[]> {
|
||||
const result = new StringMap<Declaration[]>();
|
||||
const result = createMap<string, Declaration[]>();
|
||||
|
||||
forEachChild(this, visit);
|
||||
|
||||
@@ -1931,7 +1931,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function initializeNameTable(sourceFile: SourceFile): void {
|
||||
const nameTable = new StringMap<number>();
|
||||
const nameTable = createMap<string, number>();
|
||||
|
||||
walk(sourceFile);
|
||||
sourceFile.nameTable = nameTable;
|
||||
|
||||
Reference in New Issue
Block a user