@@ -10,7 +10,7 @@ namespace ts {
10
10
}
11
11
12
12
interface ActiveLabel {
13
- name : UnderscoreEscapedString ;
13
+ name : __String ;
14
14
breakTarget : FlowLabel ;
15
15
continueTarget : FlowLabel ;
16
16
referenced : boolean ;
@@ -132,8 +132,8 @@ namespace ts {
132
132
let inStrictMode : boolean ;
133
133
134
134
let symbolCount = 0 ;
135
- let Symbol : { new ( flags : SymbolFlags , name : UnderscoreEscapedString ) : Symbol } ;
136
- let classifiableNames : UnderscoreEscapedMap < UnderscoreEscapedString > ;
135
+ let Symbol : { new ( flags : SymbolFlags , name : __String ) : Symbol } ;
136
+ let classifiableNames : UnderscoreEscapedMap < __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 = createUnderscoreEscapedMap < UnderscoreEscapedString > ( ) ;
150
+ classifiableNames = createUnderscoreEscapedMap < __String > ( ) ;
151
151
symbolCount = 0 ;
152
152
skipTransformFlagAggregation = file . isDeclarationFile ;
153
153
@@ -191,7 +191,7 @@ namespace ts {
191
191
}
192
192
}
193
193
194
- function createSymbol ( flags : SymbolFlags , name : UnderscoreEscapedString ) : Symbol {
194
+ function createSymbol ( flags : SymbolFlags , name : __String ) : Symbol {
195
195
symbolCount ++ ;
196
196
return new Symbol ( flags , name ) ;
197
197
}
@@ -226,12 +226,12 @@ namespace ts {
226
226
227
227
// Should not be called on a declaration with a computed property name,
228
228
// unless it is a well known Symbol.
229
- function getDeclarationName ( node : Declaration ) : UnderscoreEscapedString {
229
+ function getDeclarationName ( node : Declaration ) : __String {
230
230
const name = getNameOfDeclaration ( node ) ;
231
231
if ( name ) {
232
232
if ( isAmbientModule ( node ) ) {
233
233
const moduleName = getTextOfIdentifierOrLiteral ( < Identifier | LiteralExpression > name ) ;
234
- return ( isGlobalScopeAugmentation ( < ModuleDeclaration > node ) ? "__global" : `"${ moduleName } "` ) as UnderscoreEscapedString ;
234
+ return ( isGlobalScopeAugmentation ( < ModuleDeclaration > node ) ? "__global" : `"${ moduleName } "` ) as __String ;
235
235
}
236
236
if ( name . kind === SyntaxKind . ComputedPropertyName ) {
237
237
const nameExpression = ( < ComputedPropertyName > name ) . expression ;
@@ -247,42 +247,42 @@ namespace ts {
247
247
}
248
248
switch ( node . kind ) {
249
249
case SyntaxKind . Constructor :
250
- return "__constructor" ;
250
+ return InternalSymbolName . Constructor ;
251
251
case SyntaxKind . FunctionType :
252
252
case SyntaxKind . CallSignature :
253
- return "__call" ;
253
+ return InternalSymbolName . Call ;
254
254
case SyntaxKind . ConstructorType :
255
255
case SyntaxKind . ConstructSignature :
256
- return "__new" ;
256
+ return InternalSymbolName . New ;
257
257
case SyntaxKind . IndexSignature :
258
- return "__index" ;
258
+ return InternalSymbolName . Index ;
259
259
case SyntaxKind . ExportDeclaration :
260
- return "__export" ;
260
+ return InternalSymbolName . ExportStar ;
261
261
case SyntaxKind . ExportAssignment :
262
- return ( ( < ExportAssignment > node ) . isExportEquals ? "export=" : "default" ) ;
262
+ return ( ( < ExportAssignment > node ) . isExportEquals ? InternalSymbolName . ExportEquals : InternalSymbolName . Default ) ;
263
263
case SyntaxKind . BinaryExpression :
264
264
if ( getSpecialPropertyAssignmentKind ( node as BinaryExpression ) === SpecialPropertyAssignmentKind . ModuleExports ) {
265
265
// module.exports = ...
266
- return "export=" ;
266
+ return InternalSymbolName . ExportEquals ;
267
267
}
268
268
Debug . fail ( "Unknown binary declaration kind" ) ;
269
269
break ;
270
270
271
271
case SyntaxKind . FunctionDeclaration :
272
272
case SyntaxKind . ClassDeclaration :
273
- return ( hasModifier ( node , ModifierFlags . Default ) ? "default" : undefined ) ;
273
+ return ( hasModifier ( node , ModifierFlags . Default ) ? InternalSymbolName . Default : undefined ) ;
274
274
case SyntaxKind . JSDocFunctionType :
275
- return ( isJSDocConstructSignature ( node ) ? "__new" : "__call" ) ;
275
+ return ( isJSDocConstructSignature ( node ) ? InternalSymbolName . New : InternalSymbolName . Call ) ;
276
276
case SyntaxKind . Parameter :
277
277
// Parameters with names are handled at the top of this function. Parameters
278
278
// without names can only come from JSDocFunctionTypes.
279
279
Debug . assert ( node . parent . kind === SyntaxKind . JSDocFunctionType ) ;
280
280
const functionType = < JSDocFunctionType > node . parent ;
281
281
const index = indexOf ( functionType . parameters , node ) ;
282
- return "arg" + index as UnderscoreEscapedString ;
282
+ return "arg" + index as __String ;
283
283
case SyntaxKind . JSDocTypedefTag :
284
284
const parentNode = node . parent && node . parent . parent ;
285
- let nameFromParentNode : UnderscoreEscapedString ;
285
+ let nameFromParentNode : __String ;
286
286
if ( parentNode && parentNode . kind === SyntaxKind . VariableStatement ) {
287
287
if ( ( < VariableStatement > parentNode ) . declarationList . declarations . length > 0 ) {
288
288
const nameIdentifier = ( < VariableStatement > parentNode ) . declarationList . declarations [ 0 ] . name ;
@@ -313,11 +313,11 @@ namespace ts {
313
313
const isDefaultExport = hasModifier ( node , ModifierFlags . Default ) ;
314
314
315
315
// The exported symbol for an export default function/class node is always named "default"
316
- const name = isDefaultExport && parent ? "default" : getDeclarationName ( node ) ;
316
+ const name = isDefaultExport && parent ? InternalSymbolName . Default : getDeclarationName ( node ) ;
317
317
318
318
let symbol : Symbol ;
319
319
if ( name === undefined ) {
320
- symbol = createSymbol ( SymbolFlags . None , "__missing" ) ;
320
+ symbol = createSymbol ( SymbolFlags . None , InternalSymbolName . Missing ) ;
321
321
}
322
322
else {
323
323
// Check and see if the symbol table already has a symbol with this name. If not,
@@ -1007,7 +1007,7 @@ namespace ts {
1007
1007
currentFlow = unreachableFlow ;
1008
1008
}
1009
1009
1010
- function findActiveLabel ( name : UnderscoreEscapedString ) {
1010
+ function findActiveLabel ( name : __String ) {
1011
1011
if ( activeLabels ) {
1012
1012
for ( const label of activeLabels ) {
1013
1013
if ( label . name === name ) {
@@ -1170,7 +1170,7 @@ namespace ts {
1170
1170
bindEach ( node . statements ) ;
1171
1171
}
1172
1172
1173
- function pushActiveLabel ( name : UnderscoreEscapedString , breakTarget : FlowLabel , continueTarget : FlowLabel ) : ActiveLabel {
1173
+ function pushActiveLabel ( name : __String , breakTarget : FlowLabel , continueTarget : FlowLabel ) : ActiveLabel {
1174
1174
const activeLabel = {
1175
1175
name,
1176
1176
breakTarget,
@@ -1646,7 +1646,7 @@ namespace ts {
1646
1646
const symbol = createSymbol ( SymbolFlags . Signature , getDeclarationName ( node ) ) ;
1647
1647
addDeclarationToSymbol ( symbol , node , SymbolFlags . Signature ) ;
1648
1648
1649
- const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
1649
+ const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
1650
1650
addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1651
1651
typeLiteralSymbol . members = createSymbolTable ( ) ;
1652
1652
typeLiteralSymbol . members . set ( symbol . name , symbol ) ;
@@ -1694,18 +1694,18 @@ namespace ts {
1694
1694
}
1695
1695
}
1696
1696
1697
- return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , "__object" ) ;
1697
+ return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , InternalSymbolName . Object ) ;
1698
1698
}
1699
1699
1700
1700
function bindJsxAttributes ( node : JsxAttributes ) {
1701
- return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , "__jsxAttributes" ) ;
1701
+ return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , InternalSymbolName . JSXAttributes ) ;
1702
1702
}
1703
1703
1704
1704
function bindJsxAttribute ( node : JsxAttribute , symbolFlags : SymbolFlags , symbolExcludes : SymbolFlags ) {
1705
1705
return declareSymbolAndAddToSymbolTable ( node , symbolFlags , symbolExcludes ) ;
1706
1706
}
1707
1707
1708
- function bindAnonymousDeclaration ( node : Declaration , symbolFlags : SymbolFlags , name : UnderscoreEscapedString ) {
1708
+ function bindAnonymousDeclaration ( node : Declaration , symbolFlags : SymbolFlags , name : __String ) {
1709
1709
const symbol = createSymbol ( symbolFlags , name ) ;
1710
1710
addDeclarationToSymbol ( symbol , node , symbolFlags ) ;
1711
1711
}
@@ -1896,8 +1896,8 @@ namespace ts {
1896
1896
file . bindDiagnostics . push ( createFileDiagnostic ( file , span . start , span . length , message , arg0 , arg1 , arg2 ) ) ;
1897
1897
}
1898
1898
1899
- function getDestructuringParameterName ( node : Declaration ) : UnderscoreEscapedString {
1900
- return "__" + indexOf ( ( < SignatureDeclaration > node . parent ) . parameters , node ) as UnderscoreEscapedString ;
1899
+ function getDestructuringParameterName ( node : Declaration ) : __String {
1900
+ return "__" + indexOf ( ( < SignatureDeclaration > node . parent ) . parameters , node ) as __String ;
1901
1901
}
1902
1902
1903
1903
function bind ( node : Node ) : void {
@@ -2191,7 +2191,7 @@ namespace ts {
2191
2191
}
2192
2192
2193
2193
function bindAnonymousTypeWorker ( node : TypeLiteralNode | MappedTypeNode | JSDocTypeLiteral | JSDocRecordType ) {
2194
- return bindAnonymousDeclaration ( < Declaration > node , SymbolFlags . TypeLiteral , "__type" ) ;
2194
+ return bindAnonymousDeclaration ( < Declaration > node , SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
2195
2195
}
2196
2196
2197
2197
function checkTypePredicate ( node : TypePredicateNode ) {
@@ -2213,7 +2213,7 @@ namespace ts {
2213
2213
}
2214
2214
2215
2215
function bindSourceFileAsExternalModule ( ) {
2216
- bindAnonymousDeclaration ( file , SymbolFlags . ValueModule , `"${ removeFileExtension ( file . fileName ) } "` as UnderscoreEscapedString ) ;
2216
+ bindAnonymousDeclaration ( file , SymbolFlags . ValueModule , `"${ removeFileExtension ( file . fileName ) } "` as __String ) ;
2217
2217
}
2218
2218
2219
2219
function bindExportAssignment ( node : ExportAssignment | BinaryExpression ) {
@@ -2404,11 +2404,11 @@ namespace ts {
2404
2404
}
2405
2405
}
2406
2406
2407
- function lookupSymbolForName ( name : UnderscoreEscapedString ) {
2407
+ function lookupSymbolForName ( name : __String ) {
2408
2408
return ( container . symbol && container . symbol . exports && container . symbol . exports . get ( name ) ) || ( container . locals && container . locals . get ( name ) ) ;
2409
2409
}
2410
2410
2411
- function bindPropertyAssignment ( functionName : UnderscoreEscapedString , propertyAccessExpression : PropertyAccessExpression , isPrototypeProperty : boolean ) {
2411
+ function bindPropertyAssignment ( functionName : __String , propertyAccessExpression : PropertyAccessExpression , isPrototypeProperty : boolean ) {
2412
2412
let targetSymbol = lookupSymbolForName ( functionName ) ;
2413
2413
2414
2414
if ( targetSymbol && isDeclarationOfFunctionOrClassExpression ( targetSymbol ) ) {
@@ -2441,7 +2441,7 @@ namespace ts {
2441
2441
bindBlockScopedDeclaration ( node , SymbolFlags . Class , SymbolFlags . ClassExcludes ) ;
2442
2442
}
2443
2443
else {
2444
- const bindingName = node . name ? node . name . text : "__class" ;
2444
+ const bindingName = node . name ? node . name . text : InternalSymbolName . Class ;
2445
2445
bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
2446
2446
// Add name of class expression into the map for semantic classifier
2447
2447
if ( node . name ) {
@@ -2460,7 +2460,7 @@ namespace ts {
2460
2460
// Note: we check for this here because this class may be merging into a module. The
2461
2461
// module might have an exported variable called 'prototype'. We can't allow that as
2462
2462
// that would clash with the built-in 'prototype' for the class.
2463
- const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" as UnderscoreEscapedString ) ;
2463
+ const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" as __String ) ;
2464
2464
const symbolExport = symbol . exports . get ( prototypeSymbol . name ) ;
2465
2465
if ( symbolExport ) {
2466
2466
if ( node . name ) {
@@ -2554,7 +2554,7 @@ namespace ts {
2554
2554
node . flowNode = currentFlow ;
2555
2555
}
2556
2556
checkStrictModeFunctionName ( node ) ;
2557
- const bindingName = node . name ? node . name . text : "__function" ;
2557
+ const bindingName = node . name ? node . name . text : InternalSymbolName . Function ;
2558
2558
return bindAnonymousDeclaration ( node , SymbolFlags . Function , bindingName ) ;
2559
2559
}
2560
2560
@@ -2568,7 +2568,7 @@ namespace ts {
2568
2568
}
2569
2569
2570
2570
return hasDynamicName ( node )
2571
- ? bindAnonymousDeclaration ( node , symbolFlags , "__computed" )
2571
+ ? bindAnonymousDeclaration ( node , symbolFlags , InternalSymbolName . Computed )
2572
2572
: declareSymbolAndAddToSymbolTable ( node , symbolFlags , symbolExcludes ) ;
2573
2573
}
2574
2574
0 commit comments