Use native generators/iterables, remove helper cruft (#51921)

This commit is contained in:
Jake Bailey
2023-01-06 14:40:56 -08:00
committed by GitHub
parent e60c210c57
commit f1ff0de943
45 changed files with 251 additions and 532 deletions

View File

@@ -51,7 +51,6 @@ import {
getCompilerOptionsDiffValue,
getConfigFileParsingDiagnostics,
getDiagnosticText,
getEntries,
getErrorSummaryText,
getLineStarts,
getNormalizedAbsolutePath,
@@ -400,7 +399,7 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign
option.type.forEach((value, name) => {
(inverted[value] ||= []).push(name);
});
return getEntries(inverted)
return Object.entries(inverted)
.map(([, synonyms]) => synonyms.join("/"))
.join(", ");
}
@@ -1159,8 +1158,8 @@ function reportStatistics(sys: System, programOrConfig: Program | ParsedCommandL
const lineCounts = countLines(program);
if (compilerOptions.extendedDiagnostics) {
for (const key of arrayFrom(lineCounts.keys())) {
reportCountStatistic("Lines of " + key, lineCounts.get(key)!);
for (const [key, value] of lineCounts.entries()) {
reportCountStatistic("Lines of " + key, value);
}
}
else {