Skip to content

Commit 9f64a3a

Browse files
authored
Remove ts.{Map,Set,ESMap,Iterator} and associated types (microsoft#51439)
1 parent d798493 commit 9f64a3a

File tree

147 files changed

+1205
-1471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+1205
-1471
lines changed

src/.eslintrc.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313
{ "name": "clearInterval" },
1414
{ "name": "setImmediate" },
1515
{ "name": "clearImmediate" },
16-
{ "name": "performance" },
17-
{ "name": "Iterator" },
18-
{ "name": "Map" },
19-
{ "name": "ReadonlyMap" },
20-
{ "name": "Set" },
21-
{ "name": "ReadonlySet" }
16+
{ "name": "performance" }
2217
]
2318
},
2419
"overrides": [

src/cancellationToken/tsconfig.json

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"module": "commonjs",
55
"types": [
66
"node"
7-
],
8-
"lib": [
9-
"es6"
107
]
118
},
129
"include": ["**/*"]

src/compiler/binder.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
createSymbolTable, Debug, Declaration, declarationNameToString, DeleteExpression, DestructuringAssignment,
1010
DiagnosticCategory, DiagnosticMessage, DiagnosticRelatedInformation, Diagnostics, DiagnosticWithLocation,
1111
DoStatement, DynamicNamedDeclaration, ElementAccessChain, ElementAccessExpression, EntityNameExpression,
12-
EnumDeclaration, escapeLeadingUnderscores, ESMap, every, ExportAssignment, exportAssignmentIsAlias,
12+
EnumDeclaration, escapeLeadingUnderscores, every, ExportAssignment, exportAssignmentIsAlias,
1313
ExportDeclaration, ExportSpecifier, Expression, ExpressionStatement, findAncestor, FlowFlags, FlowLabel, FlowNode,
1414
FlowReduceLabel, forEach, forEachChild, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression,
1515
FunctionLikeDeclaration, GetAccessorDeclaration, getAssignedExpandoInitializer, getAssignmentDeclarationKind,
@@ -45,12 +45,12 @@ import {
4545
isVariableDeclaration, isVariableDeclarationInitializedToBareOrAccessedRequire, isVariableStatement,
4646
JSDocCallbackTag, JSDocClassTag, JSDocEnumTag, JSDocFunctionType, JSDocParameterTag, JSDocPropertyLikeTag,
4747
JSDocSignature, JSDocTypedefTag, JSDocTypeLiteral, JsxAttribute, JsxAttributes, LabeledStatement, length,
48-
LiteralLikeElementAccessExpression, Map, MappedTypeNode, MethodDeclaration, ModifierFlags, ModuleBlock,
48+
LiteralLikeElementAccessExpression, MappedTypeNode, MethodDeclaration, ModifierFlags, ModuleBlock,
4949
ModuleDeclaration, Mutable, NamespaceExportDeclaration, Node, NodeArray, NodeFlags, nodeHasName, nodeIsMissing,
5050
nodeIsPresent, NonNullChain, NonNullExpression, NumericLiteral, objectAllocator, ObjectLiteralExpression,
5151
OptionalChain, ParameterDeclaration, ParenthesizedExpression, Pattern, PatternAmbientModule, perfLogger,
5252
PostfixUnaryExpression, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessChain, PropertyAccessExpression,
53-
PropertyDeclaration, PropertySignature, removeFileExtension, ReturnStatement, ScriptTarget, Set,
53+
PropertyDeclaration, PropertySignature, removeFileExtension, ReturnStatement, ScriptTarget,
5454
SetAccessorDeclaration, setParent, setParentRecursive, setValueDeclaration, ShorthandPropertyAssignment,
5555
shouldPreserveConstEnums, SignatureDeclaration, skipParentheses, sliceAfter, some, SourceFile, SpreadElement,
5656
Statement, StringLiteral, SwitchStatement, Symbol, SymbolFlags, symbolName, SymbolTable, SyntaxKind, TextRange,
@@ -76,7 +76,7 @@ interface ActiveLabel {
7676
}
7777

7878
/** @internal */
79-
export function getModuleInstanceState(node: ModuleDeclaration, visited?: ESMap<number, ModuleInstanceState | undefined>): ModuleInstanceState {
79+
export function getModuleInstanceState(node: ModuleDeclaration, visited?: Map<number, ModuleInstanceState | undefined>): ModuleInstanceState {
8080
if (node.body && !node.body.parent) {
8181
// getModuleInstanceStateForAliasTarget needs to walk up the parent chain, so parent pointers must be set on this tree already
8282
setParent(node.body, node);
@@ -96,7 +96,7 @@ function getModuleInstanceStateCached(node: Node, visited = new Map<number, Modu
9696
return result;
9797
}
9898

99-
function getModuleInstanceStateWorker(node: Node, visited: ESMap<number, ModuleInstanceState | undefined>): ModuleInstanceState {
99+
function getModuleInstanceStateWorker(node: Node, visited: Map<number, ModuleInstanceState | undefined>): ModuleInstanceState {
100100
// A module is uninstantiated if it contains only
101101
switch (node.kind) {
102102
// 1. interface declarations, type alias declarations
@@ -168,7 +168,7 @@ function getModuleInstanceStateWorker(node: Node, visited: ESMap<number, ModuleI
168168
return ModuleInstanceState.Instantiated;
169169
}
170170

171-
function getModuleInstanceStateForAliasTarget(specifier: ExportSpecifier, visited: ESMap<number, ModuleInstanceState | undefined>) {
171+
function getModuleInstanceStateForAliasTarget(specifier: ExportSpecifier, visited: Map<number, ModuleInstanceState | undefined>) {
172172
const name = specifier.propertyName || specifier.name;
173173
let p: Node | undefined = specifier.parent;
174174
while (p) {

src/compiler/builder.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import {
77
createBuildInfo, createGetCanonicalFileName, createProgram, CustomTransformers, Debug, Diagnostic,
88
DiagnosticCategory, DiagnosticMessageChain, DiagnosticRelatedInformation, DiagnosticWithLocation,
99
EmitAndSemanticDiagnosticsBuilderProgram, EmitOnly, EmitResult, emitSkippedWithNoDiagnostics, emptyArray,
10-
ensurePathIsNonModuleName, ESMap, filterSemanticDiagnostics, forEach, forEachEntry, forEachKey, generateDjb2Hash,
10+
ensurePathIsNonModuleName, filterSemanticDiagnostics, forEach, forEachEntry, forEachKey, generateDjb2Hash,
1111
GetCanonicalFileName, getDirectoryPath, getEmitDeclarations, getNormalizedAbsolutePath, getOptionsNameMap,
1212
getOwnKeys, getRelativePathFromDirectory, getTsBuildInfoEmitOutputFilePath, handleNoEmitOptions, isArray,
13-
isDeclarationFileName, isJsonSourceFile, isNumber, isString, map, Map, mapDefined, maybeBind, noop, notImplemented,
14-
outFile, Path, Program, ProjectReference, ReadBuildProgramHost, ReadonlyCollection, ReadonlyESMap, ReadonlySet,
15-
returnFalse, returnUndefined, SemanticDiagnosticsBuilderProgram, Set, skipTypeChecking, some, SourceFile,
13+
isDeclarationFileName, isJsonSourceFile, isNumber, isString, map, mapDefined, maybeBind, noop, notImplemented,
14+
outFile, Path, Program, ProjectReference, ReadBuildProgramHost, ReadonlyCollection,
15+
returnFalse, returnUndefined, SemanticDiagnosticsBuilderProgram, skipTypeChecking, some, SourceFile,
1616
sourceFileMayBeEmitted, SourceMapEmitResult, toPath, tryAddToSet, WriteFileCallback, WriteFileCallbackData,
1717
} from "./_namespaces/ts";
1818

@@ -51,7 +51,7 @@ export interface ReusableBuilderProgramState extends BuilderState {
5151
/**
5252
* Cache of bind and check diagnostics for files with their Path being the key
5353
*/
54-
semanticDiagnosticsPerFile?: ESMap<Path, readonly ReusableDiagnostic[] | readonly Diagnostic[]> | undefined;
54+
semanticDiagnosticsPerFile?: Map<Path, readonly ReusableDiagnostic[] | readonly Diagnostic[]> | undefined;
5555
/**
5656
* The map has key by source file's path that has been changed
5757
*/
@@ -67,7 +67,7 @@ export interface ReusableBuilderProgramState extends BuilderState {
6767
/**
6868
* Files pending to be emitted
6969
*/
70-
affectedFilesPendingEmit?: ReadonlyESMap<Path, BuilderFileEmit>;
70+
affectedFilesPendingEmit?: ReadonlyMap<Path, BuilderFileEmit>;
7171
/**
7272
* emitKind pending for a program with --out
7373
*/
@@ -79,7 +79,7 @@ export interface ReusableBuilderProgramState extends BuilderState {
7979
/**
8080
* Hash of d.ts emitted for the file, use to track when emit of d.ts changes
8181
*/
82-
emitSignatures?: ESMap<Path, EmitSignature>;
82+
emitSignatures?: Map<Path, EmitSignature>;
8383
/**
8484
* Hash of d.ts emit with --out
8585
*/
@@ -118,7 +118,7 @@ export interface BuilderProgramState extends BuilderState, ReusableBuilderProgra
118118
/**
119119
* Cache of bind and check diagnostics for files with their Path being the key
120120
*/
121-
semanticDiagnosticsPerFile: ESMap<Path, readonly Diagnostic[]> | undefined;
121+
semanticDiagnosticsPerFile: Map<Path, readonly Diagnostic[]> | undefined;
122122
/**
123123
* The map has key by source file's path that has been changed
124124
*/
@@ -154,15 +154,15 @@ export interface BuilderProgramState extends BuilderState, ReusableBuilderProgra
154154
/**
155155
* Files pending to be emitted
156156
*/
157-
affectedFilesPendingEmit?: ESMap<Path, BuilderFileEmit>;
157+
affectedFilesPendingEmit?: Map<Path, BuilderFileEmit>;
158158
/**
159159
* true if build info is emitted
160160
*/
161161
buildInfoEmitPending: boolean;
162162
/**
163163
* Already seen emitted files
164164
*/
165-
seenEmittedFiles: ESMap<Path, BuilderFileEmit> | undefined;
165+
seenEmittedFiles: Map<Path, BuilderFileEmit> | undefined;
166166
/** Stores list of files that change signature during emit - test only */
167167
filesChangingSignature?: Set<Path>;
168168
}
@@ -954,7 +954,7 @@ function getBuildInfo(state: BuilderProgramState, getCanonicalFileName: GetCanon
954954
}
955955

956956
let fileIdsList: (readonly ProgramBuildInfoFileId[])[] | undefined;
957-
let fileNamesToFileIdListId: ESMap<string, ProgramBuildInfoFileIdListId> | undefined;
957+
let fileNamesToFileIdListId: Map<string, ProgramBuildInfoFileIdListId> | undefined;
958958
let emitSignatures: ProgramBuildInfoEmitSignature[] | undefined;
959959
const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]): ProgramMultiFileEmitBuildInfoFileInfo => {
960960
// Ensure fileId
@@ -1733,7 +1733,7 @@ export function getBuildInfoFileVersionMap(
17331733
program: ProgramBuildInfo,
17341734
buildInfoPath: string,
17351735
host: Pick<ReadBuildProgramHost, "useCaseSensitiveFileNames" | "getCurrentDirectory">
1736-
): ESMap<Path, string> {
1736+
): Map<Path, string> {
17371737
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
17381738
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
17391739
const fileInfos = new Map<Path, string>();

src/compiler/builderState.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
arrayFrom, CancellationToken, computeSignatureWithDiagnostics, CustomTransformers, Debug, EmitOutput, emptyArray,
3-
ESMap, ExportedModulesFromDeclarationEmit, GetCanonicalFileName, getDirectoryPath, getSourceFileOfNode,
3+
ExportedModulesFromDeclarationEmit, GetCanonicalFileName, getDirectoryPath, getSourceFileOfNode,
44
isDeclarationFileName, isExternalOrCommonJsModule, isGlobalScopeAugmentation, isJsonSourceFile,
5-
isModuleWithStringLiteralName, isStringLiteral, Iterator, Map, mapDefined, mapDefinedIterator, ModuleDeclaration,
6-
ModuleKind, outFile, OutputFile, Path, Program, ReadonlySet, Set, some, SourceFile, StringLiteralLike, Symbol,
5+
isModuleWithStringLiteralName, isStringLiteral, mapDefined, mapDefinedIterator, ModuleDeclaration,
6+
ModuleKind, outFile, OutputFile, Path, Program, some, SourceFile, StringLiteralLike, Symbol,
77
toPath, TypeChecker,
88
} from "./_namespaces/ts";
99

@@ -23,7 +23,7 @@ export interface BuilderState {
2323
/**
2424
* Information of the file eg. its version, signature etc
2525
*/
26-
fileInfos: ESMap<Path, BuilderState.FileInfo>;
26+
fileInfos: Map<Path, BuilderState.FileInfo>;
2727
/**
2828
* Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled
2929
* Otherwise undefined
@@ -52,11 +52,11 @@ export interface BuilderState {
5252
/**
5353
* Stores signatures before before the update till affected file is commited
5454
*/
55-
oldSignatures?: ESMap<Path, string | false>;
55+
oldSignatures?: Map<Path, string | false>;
5656
/**
5757
* Stores exportedModulesMap before the update till affected file is commited
5858
*/
59-
oldExportedModulesMap?: ESMap<Path, ReadonlySet<Path> | false>;
59+
oldExportedModulesMap?: Map<Path, ReadonlySet<Path> | false>;
6060
/**
6161
* Cache of all files excluding default library file for the current program
6262
*/
@@ -90,7 +90,7 @@ export namespace BuilderState {
9090
}
9191

9292
export function createManyToManyPathMap(): ManyToManyPathMap {
93-
function create(forward: ESMap<Path, ReadonlySet<Path>>, reverse: ESMap<Path, Set<Path>>, deleted: Set<Path> | undefined): ManyToManyPathMap {
93+
function create(forward: Map<Path, ReadonlySet<Path>>, reverse: Map<Path, Set<Path>>, deleted: Set<Path> | undefined): ManyToManyPathMap {
9494
const map: ManyToManyPathMap = {
9595
getKeys: v => reverse.get(v),
9696
getValues: k => forward.get(k),
@@ -136,7 +136,7 @@ export namespace BuilderState {
136136
return create(new Map<Path, Set<Path>>(), new Map<Path, Set<Path>>(), /*deleted*/ undefined);
137137
}
138138

139-
function addToMultimap<K, V>(map: ESMap<K, Set<V>>, k: K, v: V): void {
139+
function addToMultimap<K, V>(map: Map<K, Set<V>>, k: K, v: V): void {
140140
let set = map.get(k);
141141
if (!set) {
142142
set = new Set<V>();
@@ -145,7 +145,7 @@ export namespace BuilderState {
145145
set.add(v);
146146
}
147147

148-
function deleteFromMultimap<K, V>(map: ESMap<K, Set<V>>, k: K, v: V): boolean {
148+
function deleteFromMultimap<K, V>(map: Map<K, Set<V>>, k: K, v: V): boolean {
149149
const set = map.get(k);
150150

151151
if (set?.delete(v)) {

0 commit comments

Comments
 (0)