@@ -133,7 +133,7 @@ namespace ts {
133133
134134 let symbolCount = 0 ;
135135 let Symbol : { new ( flags : SymbolFlags , name : string ) : Symbol } ;
136- let classifiableNames : Set < string > ;
136+ let classifiableNames : Map < string > ;
137137
138138 const unreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
139139 const reportedUnreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
@@ -147,7 +147,7 @@ namespace ts {
147147 options = opts ;
148148 languageVersion = getEmitScriptTarget ( options ) ;
149149 inStrictMode = bindInStrictMode ( file , opts ) ;
150- classifiableNames = createSet ( ) ;
150+ classifiableNames = createMap < string > ( ) ;
151151 symbolCount = 0 ;
152152 skipTransformFlagAggregation = isDeclarationFile ( file ) ;
153153
@@ -207,11 +207,11 @@ namespace ts {
207207 symbol . declarations . push ( node ) ;
208208
209209 if ( symbolFlags & SymbolFlags . HasExports && ! symbol . exports ) {
210- symbol . exports = createMap < string , Symbol > ( ) ;
210+ symbol . exports = createMap < Symbol > ( ) ;
211211 }
212212
213213 if ( symbolFlags & SymbolFlags . HasMembers && ! symbol . members ) {
214- symbol . members = createMap < string , Symbol > ( ) ;
214+ symbol . members = createMap < Symbol > ( ) ;
215215 }
216216
217217 if ( symbolFlags & SymbolFlags . Value ) {
@@ -349,17 +349,17 @@ namespace ts {
349349 // Otherwise, we'll be merging into a compatible existing symbol (for example when
350350 // you have multiple 'vars' with the same name in the same container). In this case
351351 // 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 ) ) ;
353353
354354 if ( name && ( includes & SymbolFlags . Classifiable ) ) {
355- classifiableNames . add ( name ) ;
355+ classifiableNames [ name ] = name ;
356356 }
357357
358358 if ( symbol . flags & excludes ) {
359359 if ( symbol . isReplaceableByMethod ) {
360360 // Javascript constructor-declared symbols can be discarded in favor of
361361 // prototype symbols like methods.
362- symbol = setAndReturn ( symbolTable , name , createSymbol ( SymbolFlags . None , name ) ) ;
362+ symbol = symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ;
363363 }
364364 else {
365365 if ( node . name ) {
@@ -484,7 +484,7 @@ namespace ts {
484484 if ( containerFlags & ContainerFlags . IsContainer ) {
485485 container = blockScopeContainer = node ;
486486 if ( containerFlags & ContainerFlags . HasLocals ) {
487- container . locals = createMap < string , Symbol > ( ) ;
487+ container . locals = createMap < Symbol > ( ) ;
488488 }
489489 addToContainerChain ( container ) ;
490490 }
@@ -1525,7 +1525,8 @@ namespace ts {
15251525
15261526 const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
15271527 addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1528- typeLiteralSymbol . members = createMap ( [ [ symbol . name , symbol ] ] ) ;
1528+ typeLiteralSymbol . members = createMap < Symbol > ( ) ;
1529+ typeLiteralSymbol . members [ symbol . name ] = symbol ;
15291530 }
15301531
15311532 function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1535,7 +1536,7 @@ namespace ts {
15351536 }
15361537
15371538 if ( inStrictMode ) {
1538- const seen = createMap < string , ElementKind > ( ) ;
1539+ const seen = createMap < ElementKind > ( ) ;
15391540
15401541 for ( const prop of node . properties ) {
15411542 if ( prop . name . kind !== SyntaxKind . Identifier ) {
@@ -1556,9 +1557,9 @@ namespace ts {
15561557 ? ElementKind . Property
15571558 : ElementKind . Accessor ;
15581559
1559- const existingKind = seen . get ( identifier . text ) ;
1560+ const existingKind = seen [ identifier . text ] ;
15601561 if ( ! existingKind ) {
1561- seen . set ( identifier . text , currentKind ) ;
1562+ seen [ identifier . text ] = currentKind ;
15621563 continue ;
15631564 }
15641565
@@ -1591,7 +1592,7 @@ namespace ts {
15911592 // fall through.
15921593 default :
15931594 if ( ! blockScopeContainer . locals ) {
1594- blockScopeContainer . locals = createMap < string , Symbol > ( ) ;
1595+ blockScopeContainer . locals = createMap < Symbol > ( ) ;
15951596 addToContainerChain ( blockScopeContainer ) ;
15961597 }
15971598 declareSymbol ( blockScopeContainer . locals , undefined , node , symbolFlags , symbolExcludes ) ;
@@ -2071,7 +2072,7 @@ namespace ts {
20712072 }
20722073 }
20732074
2074- file . symbol . globalExports = file . symbol . globalExports || createMap < string , Symbol > ( ) ;
2075+ file . symbol . globalExports = file . symbol . globalExports || createMap < Symbol > ( ) ;
20752076 declareSymbol ( file . symbol . globalExports , file . symbol , node , SymbolFlags . Alias , SymbolFlags . AliasExcludes ) ;
20762077 }
20772078
@@ -2118,7 +2119,7 @@ namespace ts {
21182119 Debug . assert ( isInJavaScriptFile ( node ) ) ;
21192120 // Declare a 'member' if the container is an ES5 class or ES6 constructor
21202121 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 > ( ) ;
21222123 // It's acceptable for multiple 'this' assignments of the same identifier to occur
21232124 declareSymbol ( container . symbol . members , container . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
21242125 }
@@ -2150,14 +2151,14 @@ namespace ts {
21502151 constructorFunction . parent = classPrototype ;
21512152 classPrototype . parent = leftSideOfAssignment ;
21522153
2153- const funcSymbol = container . locals . get ( constructorFunction . text ) ;
2154+ const funcSymbol = container . locals [ constructorFunction . text ] ;
21542155 if ( ! funcSymbol || ! ( funcSymbol . flags & SymbolFlags . Function || isDeclarationOfFunctionExpression ( funcSymbol ) ) ) {
21552156 return ;
21562157 }
21572158
21582159 // Set up the members collection if it doesn't exist already
21592160 if ( ! funcSymbol . members ) {
2160- funcSymbol . members = createMap < string , Symbol > ( ) ;
2161+ funcSymbol . members = createMap < Symbol > ( ) ;
21612162 }
21622163
21632164 // Declare the method/property
@@ -2190,7 +2191,7 @@ namespace ts {
21902191 bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
21912192 // Add name of class expression into the map for semantic classifier
21922193 if ( node . name ) {
2193- classifiableNames . add ( node . name . text ) ;
2194+ classifiableNames [ node . name . text ] = node . name . text ;
21942195 }
21952196 }
21962197
@@ -2206,15 +2207,14 @@ namespace ts {
22062207 // module might have an exported variable called 'prototype'. We can't allow that as
22072208 // that would clash with the built-in 'prototype' for the class.
22082209 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 ] ) {
22112211 if ( node . name ) {
22122212 node . name . parent = node ;
22132213 }
2214- file . bindDiagnostics . push ( createDiagnosticForNode ( symbolExport . declarations [ 0 ] ,
2214+ file . bindDiagnostics . push ( createDiagnosticForNode ( symbol . exports [ prototypeSymbol . name ] . declarations [ 0 ] ,
22152215 Diagnostics . Duplicate_identifier_0 , prototypeSymbol . name ) ) ;
22162216 }
2217- symbol . exports . set ( prototypeSymbol . name , prototypeSymbol ) ;
2217+ symbol . exports [ prototypeSymbol . name ] = prototypeSymbol ;
22182218 prototypeSymbol . parent = symbol ;
22192219 }
22202220
0 commit comments