@@ -133,7 +133,7 @@ namespace ts {
133
133
134
134
let symbolCount = 0 ;
135
135
let Symbol : { new ( flags : SymbolFlags , name : string ) : Symbol } ;
136
- let classifiableNames : Set < string > ;
136
+ let classifiableNames : Map < string > ;
137
137
138
138
const unreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
139
139
const reportedUnreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
@@ -147,7 +147,7 @@ namespace ts {
147
147
options = opts ;
148
148
languageVersion = getEmitScriptTarget ( options ) ;
149
149
inStrictMode = bindInStrictMode ( file , opts ) ;
150
- classifiableNames = createSet ( ) ;
150
+ classifiableNames = createMap < string > ( ) ;
151
151
symbolCount = 0 ;
152
152
skipTransformFlagAggregation = isDeclarationFile ( file ) ;
153
153
@@ -207,11 +207,11 @@ namespace ts {
207
207
symbol . declarations . push ( node ) ;
208
208
209
209
if ( symbolFlags & SymbolFlags . HasExports && ! symbol . exports ) {
210
- symbol . exports = createMap < string , Symbol > ( ) ;
210
+ symbol . exports = createMap < Symbol > ( ) ;
211
211
}
212
212
213
213
if ( symbolFlags & SymbolFlags . HasMembers && ! symbol . members ) {
214
- symbol . members = createMap < string , Symbol > ( ) ;
214
+ symbol . members = createMap < Symbol > ( ) ;
215
215
}
216
216
217
217
if ( symbolFlags & SymbolFlags . Value ) {
@@ -349,17 +349,17 @@ namespace ts {
349
349
// Otherwise, we'll be merging into a compatible existing symbol (for example when
350
350
// you have multiple 'vars' with the same name in the same container). In this case
351
351
// just add this node into the declarations list of the symbol.
352
- symbol = getOrUpdate ( symbolTable , name , name => createSymbol ( SymbolFlags . None , name ) ) ;
352
+ symbol = symbolTable [ name ] || ( symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ) ;
353
353
354
354
if ( name && ( includes & SymbolFlags . Classifiable ) ) {
355
- classifiableNames . add ( name ) ;
355
+ classifiableNames [ name ] = name ;
356
356
}
357
357
358
358
if ( symbol . flags & excludes ) {
359
359
if ( symbol . isReplaceableByMethod ) {
360
360
// Javascript constructor-declared symbols can be discarded in favor of
361
361
// prototype symbols like methods.
362
- symbol = setAndReturn ( symbolTable , name , createSymbol ( SymbolFlags . None , name ) ) ;
362
+ symbol = symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ;
363
363
}
364
364
else {
365
365
if ( node . name ) {
@@ -484,7 +484,7 @@ namespace ts {
484
484
if ( containerFlags & ContainerFlags . IsContainer ) {
485
485
container = blockScopeContainer = node ;
486
486
if ( containerFlags & ContainerFlags . HasLocals ) {
487
- container . locals = createMap < string , Symbol > ( ) ;
487
+ container . locals = createMap < Symbol > ( ) ;
488
488
}
489
489
addToContainerChain ( container ) ;
490
490
}
@@ -1525,7 +1525,8 @@ namespace ts {
1525
1525
1526
1526
const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
1527
1527
addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1528
- typeLiteralSymbol . members = createMap ( [ [ symbol . name , symbol ] ] ) ;
1528
+ typeLiteralSymbol . members = createMap < Symbol > ( ) ;
1529
+ typeLiteralSymbol . members [ symbol . name ] = symbol ;
1529
1530
}
1530
1531
1531
1532
function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1535,7 +1536,7 @@ namespace ts {
1535
1536
}
1536
1537
1537
1538
if ( inStrictMode ) {
1538
- const seen = createMap < string , ElementKind > ( ) ;
1539
+ const seen = createMap < ElementKind > ( ) ;
1539
1540
1540
1541
for ( const prop of node . properties ) {
1541
1542
if ( prop . name . kind !== SyntaxKind . Identifier ) {
@@ -1556,9 +1557,9 @@ namespace ts {
1556
1557
? ElementKind . Property
1557
1558
: ElementKind . Accessor ;
1558
1559
1559
- const existingKind = seen . get ( identifier . text ) ;
1560
+ const existingKind = seen [ identifier . text ] ;
1560
1561
if ( ! existingKind ) {
1561
- seen . set ( identifier . text , currentKind ) ;
1562
+ seen [ identifier . text ] = currentKind ;
1562
1563
continue ;
1563
1564
}
1564
1565
@@ -1591,7 +1592,7 @@ namespace ts {
1591
1592
// fall through.
1592
1593
default :
1593
1594
if ( ! blockScopeContainer . locals ) {
1594
- blockScopeContainer . locals = createMap < string , Symbol > ( ) ;
1595
+ blockScopeContainer . locals = createMap < Symbol > ( ) ;
1595
1596
addToContainerChain ( blockScopeContainer ) ;
1596
1597
}
1597
1598
declareSymbol ( blockScopeContainer . locals , undefined , node , symbolFlags , symbolExcludes ) ;
@@ -2071,7 +2072,7 @@ namespace ts {
2071
2072
}
2072
2073
}
2073
2074
2074
- file . symbol . globalExports = file . symbol . globalExports || createMap < string , Symbol > ( ) ;
2075
+ file . symbol . globalExports = file . symbol . globalExports || createMap < Symbol > ( ) ;
2075
2076
declareSymbol ( file . symbol . globalExports , file . symbol , node , SymbolFlags . Alias , SymbolFlags . AliasExcludes ) ;
2076
2077
}
2077
2078
@@ -2118,7 +2119,7 @@ namespace ts {
2118
2119
Debug . assert ( isInJavaScriptFile ( node ) ) ;
2119
2120
// Declare a 'member' if the container is an ES5 class or ES6 constructor
2120
2121
if ( container . kind === SyntaxKind . FunctionDeclaration || container . kind === SyntaxKind . FunctionExpression ) {
2121
- container . symbol . members = container . symbol . members || createMap < string , Symbol > ( ) ;
2122
+ container . symbol . members = container . symbol . members || createMap < Symbol > ( ) ;
2122
2123
// It's acceptable for multiple 'this' assignments of the same identifier to occur
2123
2124
declareSymbol ( container . symbol . members , container . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
2124
2125
}
@@ -2150,14 +2151,14 @@ namespace ts {
2150
2151
constructorFunction . parent = classPrototype ;
2151
2152
classPrototype . parent = leftSideOfAssignment ;
2152
2153
2153
- const funcSymbol = container . locals . get ( constructorFunction . text ) ;
2154
+ const funcSymbol = container . locals [ constructorFunction . text ] ;
2154
2155
if ( ! funcSymbol || ! ( funcSymbol . flags & SymbolFlags . Function || isDeclarationOfFunctionExpression ( funcSymbol ) ) ) {
2155
2156
return ;
2156
2157
}
2157
2158
2158
2159
// Set up the members collection if it doesn't exist already
2159
2160
if ( ! funcSymbol . members ) {
2160
- funcSymbol . members = createMap < string , Symbol > ( ) ;
2161
+ funcSymbol . members = createMap < Symbol > ( ) ;
2161
2162
}
2162
2163
2163
2164
// Declare the method/property
@@ -2190,7 +2191,7 @@ namespace ts {
2190
2191
bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
2191
2192
// Add name of class expression into the map for semantic classifier
2192
2193
if ( node . name ) {
2193
- classifiableNames . add ( node . name . text ) ;
2194
+ classifiableNames [ node . name . text ] = node . name . text ;
2194
2195
}
2195
2196
}
2196
2197
@@ -2206,15 +2207,14 @@ namespace ts {
2206
2207
// module might have an exported variable called 'prototype'. We can't allow that as
2207
2208
// that would clash with the built-in 'prototype' for the class.
2208
2209
const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" ) ;
2209
- const symbolExport = symbol . exports . get ( prototypeSymbol . name ) ;
2210
- if ( symbolExport ) {
2210
+ if ( symbol . exports [ prototypeSymbol . name ] ) {
2211
2211
if ( node . name ) {
2212
2212
node . name . parent = node ;
2213
2213
}
2214
- file . bindDiagnostics . push ( createDiagnosticForNode ( symbolExport . declarations [ 0 ] ,
2214
+ file . bindDiagnostics . push ( createDiagnosticForNode ( symbol . exports [ prototypeSymbol . name ] . declarations [ 0 ] ,
2215
2215
Diagnostics . Duplicate_identifier_0 , prototypeSymbol . name ) ) ;
2216
2216
}
2217
- symbol . exports . set ( prototypeSymbol . name , prototypeSymbol ) ;
2217
+ symbol . exports [ prototypeSymbol . name ] = prototypeSymbol ;
2218
2218
prototypeSymbol . parent = symbol ;
2219
2219
}
2220
2220
0 commit comments