Rename and consolidate map iteration helpers

This commit is contained in:
Andy Hanson
2016-12-28 09:16:38 -08:00
parent 39c19a74ea
commit 932eaa3f90
13 changed files with 32 additions and 55 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/// <reference path='../compiler/utilities.ts' />
/// <reference path='../compiler/utilities.ts' />
/* @internal */
namespace ts.Completions {
@@ -378,7 +378,7 @@ namespace ts.Completions {
}
}
forEachKeyInMap(foundFiles, foundFile => {
forEachKey(foundFiles, foundFile => {
result.push(createCompletionEntryForModule(foundFile, ScriptElementKind.scriptElement, span));
});
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* @internal */
/* @internal */
namespace ts.FindAllReferences {
export function findReferencedSymbols(typeChecker: TypeChecker, cancellationToken: CancellationToken, sourceFiles: SourceFile[], sourceFile: SourceFile, position: number, findInStrings: boolean, findInComments: boolean): ReferencedSymbol[] {
const node = getTouchingPropertyName(sourceFile, position, /*includeJsDocComment*/ true);
@@ -508,7 +508,7 @@ namespace ts.FindAllReferences {
result.push(ctrKeyword);
}
forEachInMap(classSymbol.exports, member => {
classSymbol.exports.forEach(member => {
const decl = member.valueDeclaration;
if (decl && decl.kind === SyntaxKind.MethodDeclaration) {
const body = (<MethodDeclaration>decl).body;
+2 -2
View File
@@ -1,4 +1,4 @@
/* @internal */
/* @internal */
namespace ts.NavigateTo {
type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration };
@@ -14,7 +14,7 @@ namespace ts.NavigateTo {
continue;
}
forEachInMap(sourceFile.getNamedDeclarations(), (declarations, name) => {
forEachEntry(sourceFile.getNamedDeclarations(), (declarations, name) => {
if (declarations) {
// First do a quick check to see if the name of the declaration matches the
// last portion of the (possibly) dotted name they're searching for.
+3 -3
View File
@@ -1,4 +1,4 @@
namespace ts {
namespace ts {
export interface TranspileOptions {
compilerOptions?: CompilerOptions;
fileName?: string;
@@ -126,7 +126,7 @@ namespace ts {
function fixupCompilerOptions(options: CompilerOptions, diagnostics: Diagnostic[]): CompilerOptions {
// Lazily create this value to fix module loading errors.
commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || <CommandLineOptionOfCustomType[]>filter(optionDeclarations, o =>
typeof o.type === "object" && !forEachInMap(o.type, v => typeof v !== "number"));
typeof o.type === "object" && !forEachEntry(o.type, v => typeof v !== "number"));
options = clone(options);
@@ -142,7 +142,7 @@ namespace ts {
options[opt.name] = parseCustomTypeOption(opt, value, diagnostics);
}
else {
if (!someInMap(opt.type, v => v === value)) {
if (!forEachEntry(opt.type, v => v === value)) {
// Supplied value isn't a valid enum value.
diagnostics.push(createCompilerDiagnosticForInvalidCustomType(opt));
}