@@ -126,7 +126,7 @@ namespace ts {
126
126
127
127
let symbolCount = 0 ;
128
128
let Symbol : { new ( flags : SymbolFlags , name : string ) : Symbol } ;
129
- let classifiableNames : Map < string > ;
129
+ let classifiableNames : Set ;
130
130
131
131
const unreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
132
132
const reportedUnreachableFlow : FlowNode = { flags : FlowFlags . Unreachable } ;
@@ -140,7 +140,7 @@ namespace ts {
140
140
options = opts ;
141
141
languageVersion = getEmitScriptTarget ( options ) ;
142
142
inStrictMode = ! ! file . externalModuleIndicator ;
143
- classifiableNames = createMap < string > ( ) ;
143
+ classifiableNames = createSet ( ) ;
144
144
symbolCount = 0 ;
145
145
skipTransformFlagAggregation = isDeclarationFile ( file ) ;
146
146
@@ -332,17 +332,17 @@ namespace ts {
332
332
// Otherwise, we'll be merging into a compatible existing symbol (for example when
333
333
// you have multiple 'vars' with the same name in the same container). In this case
334
334
// just add this node into the declarations list of the symbol.
335
- symbol = symbolTable [ name ] || ( symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ) ;
335
+ symbol = _getOrUpdate ( symbolTable , name , name => createSymbol ( SymbolFlags . None , name ) ) ;
336
336
337
337
if ( name && ( includes & SymbolFlags . Classifiable ) ) {
338
- classifiableNames [ name ] = name ;
338
+ _add ( classifiableNames , name ) ;
339
339
}
340
340
341
341
if ( symbol . flags & excludes ) {
342
342
if ( symbol . isReplaceableByMethod ) {
343
343
// Javascript constructor-declared symbols can be discarded in favor of
344
344
// prototype symbols like methods.
345
- symbol = symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ;
345
+ symbol = _s ( symbolTable , name , createSymbol ( SymbolFlags . None , name ) ) ;
346
346
}
347
347
else {
348
348
if ( node . name ) {
@@ -1444,7 +1444,7 @@ namespace ts {
1444
1444
const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
1445
1445
addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1446
1446
typeLiteralSymbol . members = createMap < Symbol > ( ) ;
1447
- typeLiteralSymbol . members [ symbol . name ] = symbol ;
1447
+ _s ( typeLiteralSymbol . members , symbol . name , symbol ) ;
1448
1448
}
1449
1449
1450
1450
function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1475,9 +1475,9 @@ namespace ts {
1475
1475
? ElementKind . Property
1476
1476
: ElementKind . Accessor ;
1477
1477
1478
- const existingKind = seen [ identifier . text ] ;
1478
+ const existingKind = _g ( seen , identifier . text ) ;
1479
1479
if ( ! existingKind ) {
1480
- seen [ identifier . text ] = currentKind ;
1480
+ _s ( seen , identifier . text , currentKind ) ;
1481
1481
continue ;
1482
1482
}
1483
1483
@@ -2049,7 +2049,7 @@ namespace ts {
2049
2049
constructorFunction . parent = classPrototype ;
2050
2050
classPrototype . parent = leftSideOfAssignment ;
2051
2051
2052
- const funcSymbol = container . locals [ constructorFunction . text ] ;
2052
+ const funcSymbol = _g ( container . locals , constructorFunction . text ) ;
2053
2053
if ( ! funcSymbol || ! ( funcSymbol . flags & SymbolFlags . Function || isDeclarationOfFunctionExpression ( funcSymbol ) ) ) {
2054
2054
return ;
2055
2055
}
@@ -2089,7 +2089,7 @@ namespace ts {
2089
2089
bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
2090
2090
// Add name of class expression into the map for semantic classifier
2091
2091
if ( node . name ) {
2092
- classifiableNames [ node . name . text ] = node . name . text ;
2092
+ _add ( classifiableNames , node . name . text ) ;
2093
2093
}
2094
2094
}
2095
2095
@@ -2105,14 +2105,15 @@ namespace ts {
2105
2105
// module might have an exported variable called 'prototype'. We can't allow that as
2106
2106
// that would clash with the built-in 'prototype' for the class.
2107
2107
const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" ) ;
2108
- if ( symbol . exports [ prototypeSymbol . name ] ) {
2108
+ const symbolExport = _g ( symbol . exports , prototypeSymbol . name ) ;
2109
+ if ( symbolExport ) {
2109
2110
if ( node . name ) {
2110
2111
node . name . parent = node ;
2111
2112
}
2112
- file . bindDiagnostics . push ( createDiagnosticForNode ( symbol . exports [ prototypeSymbol . name ] . declarations [ 0 ] ,
2113
+ file . bindDiagnostics . push ( createDiagnosticForNode ( symbolExport . declarations [ 0 ] ,
2113
2114
Diagnostics . Duplicate_identifier_0 , prototypeSymbol . name ) ) ;
2114
2115
}
2115
- symbol . exports [ prototypeSymbol . name ] = prototypeSymbol ;
2116
+ _s ( symbol . exports , prototypeSymbol . name , prototypeSymbol ) ;
2116
2117
prototypeSymbol . parent = symbol ;
2117
2118
}
2118
2119
0 commit comments