@@ -135,7 +135,7 @@ namespace ts {
135
135
options = opts ;
136
136
languageVersion = getEmitScriptTarget ( options ) ;
137
137
inStrictMode = ! ! file . externalModuleIndicator ;
138
- classifiableNames = { } ;
138
+ classifiableNames = createMap < string > ( ) ;
139
139
symbolCount = 0 ;
140
140
141
141
Symbol = objectAllocator . getSymbolConstructor ( ) ;
@@ -183,11 +183,11 @@ namespace ts {
183
183
symbol . declarations . push ( node ) ;
184
184
185
185
if ( symbolFlags & SymbolFlags . HasExports && ! symbol . exports ) {
186
- symbol . exports = { } ;
186
+ symbol . exports = createMap < Symbol > ( ) ;
187
187
}
188
188
189
189
if ( symbolFlags & SymbolFlags . HasMembers && ! symbol . members ) {
190
- symbol . members = { } ;
190
+ symbol . members = createMap < Symbol > ( ) ;
191
191
}
192
192
193
193
if ( symbolFlags & SymbolFlags . Value ) {
@@ -318,9 +318,7 @@ namespace ts {
318
318
// Otherwise, we'll be merging into a compatible existing symbol (for example when
319
319
// you have multiple 'vars' with the same name in the same container). In this case
320
320
// just add this node into the declarations list of the symbol.
321
- symbol = hasProperty ( symbolTable , name )
322
- ? symbolTable [ name ]
323
- : ( symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ) ;
321
+ symbol = symbolTable [ name ] || ( symbolTable [ name ] = createSymbol ( SymbolFlags . None , name ) ) ;
324
322
325
323
if ( name && ( includes & SymbolFlags . Classifiable ) ) {
326
324
classifiableNames [ name ] = name ;
@@ -434,7 +432,7 @@ namespace ts {
434
432
if ( containerFlags & ContainerFlags . IsContainer ) {
435
433
container = blockScopeContainer = node ;
436
434
if ( containerFlags & ContainerFlags . HasLocals ) {
437
- container . locals = { } ;
435
+ container . locals = createMap < Symbol > ( ) ;
438
436
}
439
437
addToContainerChain ( container ) ;
440
438
}
@@ -1399,7 +1397,8 @@ namespace ts {
1399
1397
1400
1398
const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
1401
1399
addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1402
- typeLiteralSymbol . members = { [ symbol . name ] : symbol } ;
1400
+ typeLiteralSymbol . members = createMap < Symbol > ( ) ;
1401
+ typeLiteralSymbol . members [ symbol . name ] = symbol ;
1403
1402
}
1404
1403
1405
1404
function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1409,7 +1408,7 @@ namespace ts {
1409
1408
}
1410
1409
1411
1410
if ( inStrictMode ) {
1412
- const seen : Map < ElementKind > = { } ;
1411
+ const seen = createMap < ElementKind > ( ) ;
1413
1412
1414
1413
for ( const prop of node . properties ) {
1415
1414
if ( prop . name . kind !== SyntaxKind . Identifier ) {
@@ -1465,7 +1464,7 @@ namespace ts {
1465
1464
// fall through.
1466
1465
default :
1467
1466
if ( ! blockScopeContainer . locals ) {
1468
- blockScopeContainer . locals = { } ;
1467
+ blockScopeContainer . locals = createMap < Symbol > ( ) ;
1469
1468
addToContainerChain ( blockScopeContainer ) ;
1470
1469
}
1471
1470
declareSymbol ( blockScopeContainer . locals , undefined , node , symbolFlags , symbolExcludes ) ;
@@ -1924,7 +1923,7 @@ namespace ts {
1924
1923
}
1925
1924
}
1926
1925
1927
- file . symbol . globalExports = file . symbol . globalExports || { } ;
1926
+ file . symbol . globalExports = file . symbol . globalExports || createMap < Symbol > ( ) ;
1928
1927
declareSymbol ( file . symbol . globalExports , file . symbol , node , SymbolFlags . Alias , SymbolFlags . AliasExcludes ) ;
1929
1928
}
1930
1929
@@ -1977,7 +1976,7 @@ namespace ts {
1977
1976
else {
1978
1977
return ;
1979
1978
}
1980
- assignee . symbol . members = assignee . symbol . members || { } ;
1979
+ assignee . symbol . members = assignee . symbol . members || createMap < Symbol > ( ) ;
1981
1980
// It's acceptable for multiple 'this' assignments of the same identifier to occur
1982
1981
declareSymbol ( assignee . symbol . members , assignee . symbol , node , SymbolFlags . Property , SymbolFlags . PropertyExcludes & ~ SymbolFlags . Property ) ;
1983
1982
}
@@ -2003,7 +2002,7 @@ namespace ts {
2003
2002
2004
2003
// Set up the members collection if it doesn't exist already
2005
2004
if ( ! funcSymbol . members ) {
2006
- funcSymbol . members = { } ;
2005
+ funcSymbol . members = createMap < Symbol > ( ) ;
2007
2006
}
2008
2007
2009
2008
// Declare the method/property
@@ -2052,7 +2051,7 @@ namespace ts {
2052
2051
// module might have an exported variable called 'prototype'. We can't allow that as
2053
2052
// that would clash with the built-in 'prototype' for the class.
2054
2053
const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" ) ;
2055
- if ( hasProperty ( symbol . exports , prototypeSymbol . name ) ) {
2054
+ if ( symbol . exports [ prototypeSymbol . name ] ) {
2056
2055
if ( node . name ) {
2057
2056
node . name . parent = node ;
2058
2057
}
0 commit comments