@@ -10,7 +10,7 @@ namespace ts {
1010 }
1111
1212 interface ActiveLabel {
13- name : UnderscoreEscapedString ;
13+ name : __String ;
1414 breakTarget : FlowLabel ;
1515 continueTarget : FlowLabel ;
1616 referenced : boolean ;
@@ -132,8 +132,8 @@ namespace ts {
132132 let inStrictMode : boolean ;
133133
134134 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 > ;
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 = createUnderscoreEscapedMap < UnderscoreEscapedString > ( ) ;
150+ classifiableNames = createUnderscoreEscapedMap < __String > ( ) ;
151151 symbolCount = 0 ;
152152 skipTransformFlagAggregation = file . isDeclarationFile ;
153153
@@ -191,7 +191,7 @@ namespace ts {
191191 }
192192 }
193193
194- function createSymbol ( flags : SymbolFlags , name : UnderscoreEscapedString ) : Symbol {
194+ function createSymbol ( flags : SymbolFlags , name : __String ) : Symbol {
195195 symbolCount ++ ;
196196 return new Symbol ( flags , name ) ;
197197 }
@@ -226,12 +226,12 @@ namespace ts {
226226
227227 // Should not be called on a declaration with a computed property name,
228228 // unless it is a well known Symbol.
229- function getDeclarationName ( node : Declaration ) : UnderscoreEscapedString {
229+ function getDeclarationName ( node : Declaration ) : __String {
230230 const name = getNameOfDeclaration ( node ) ;
231231 if ( name ) {
232232 if ( isAmbientModule ( node ) ) {
233233 const moduleName = getTextOfIdentifierOrLiteral ( < Identifier | LiteralExpression > name ) ;
234- return ( isGlobalScopeAugmentation ( < ModuleDeclaration > node ) ? "__global" : `"${ moduleName } "` ) as UnderscoreEscapedString ;
234+ return ( isGlobalScopeAugmentation ( < ModuleDeclaration > node ) ? "__global" : `"${ moduleName } "` ) as __String ;
235235 }
236236 if ( name . kind === SyntaxKind . ComputedPropertyName ) {
237237 const nameExpression = ( < ComputedPropertyName > name ) . expression ;
@@ -247,42 +247,42 @@ namespace ts {
247247 }
248248 switch ( node . kind ) {
249249 case SyntaxKind . Constructor :
250- return "__constructor" ;
250+ return InternalSymbolName . Constructor ;
251251 case SyntaxKind . FunctionType :
252252 case SyntaxKind . CallSignature :
253- return "__call" ;
253+ return InternalSymbolName . Call ;
254254 case SyntaxKind . ConstructorType :
255255 case SyntaxKind . ConstructSignature :
256- return "__new" ;
256+ return InternalSymbolName . New ;
257257 case SyntaxKind . IndexSignature :
258- return "__index" ;
258+ return InternalSymbolName . Index ;
259259 case SyntaxKind . ExportDeclaration :
260- return "__export" ;
260+ return InternalSymbolName . ExportStar ;
261261 case SyntaxKind . ExportAssignment :
262- return ( ( < ExportAssignment > node ) . isExportEquals ? "export=" : "default" ) ;
262+ return ( ( < ExportAssignment > node ) . isExportEquals ? InternalSymbolName . ExportEquals : InternalSymbolName . Default ) ;
263263 case SyntaxKind . BinaryExpression :
264264 if ( getSpecialPropertyAssignmentKind ( node as BinaryExpression ) === SpecialPropertyAssignmentKind . ModuleExports ) {
265265 // module.exports = ...
266- return "export=" ;
266+ return InternalSymbolName . ExportEquals ;
267267 }
268268 Debug . fail ( "Unknown binary declaration kind" ) ;
269269 break ;
270270
271271 case SyntaxKind . FunctionDeclaration :
272272 case SyntaxKind . ClassDeclaration :
273- return ( hasModifier ( node , ModifierFlags . Default ) ? "default" : undefined ) ;
273+ return ( hasModifier ( node , ModifierFlags . Default ) ? InternalSymbolName . Default : undefined ) ;
274274 case SyntaxKind . JSDocFunctionType :
275- return ( isJSDocConstructSignature ( node ) ? "__new" : "__call" ) ;
275+ return ( isJSDocConstructSignature ( node ) ? InternalSymbolName . New : InternalSymbolName . Call ) ;
276276 case SyntaxKind . Parameter :
277277 // Parameters with names are handled at the top of this function. Parameters
278278 // without names can only come from JSDocFunctionTypes.
279279 Debug . assert ( node . parent . kind === SyntaxKind . JSDocFunctionType ) ;
280280 const functionType = < JSDocFunctionType > node . parent ;
281281 const index = indexOf ( functionType . parameters , node ) ;
282- return "arg" + index as UnderscoreEscapedString ;
282+ return "arg" + index as __String ;
283283 case SyntaxKind . JSDocTypedefTag :
284284 const parentNode = node . parent && node . parent . parent ;
285- let nameFromParentNode : UnderscoreEscapedString ;
285+ let nameFromParentNode : __String ;
286286 if ( parentNode && parentNode . kind === SyntaxKind . VariableStatement ) {
287287 if ( ( < VariableStatement > parentNode ) . declarationList . declarations . length > 0 ) {
288288 const nameIdentifier = ( < VariableStatement > parentNode ) . declarationList . declarations [ 0 ] . name ;
@@ -313,11 +313,11 @@ namespace ts {
313313 const isDefaultExport = hasModifier ( node , ModifierFlags . Default ) ;
314314
315315 // 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 ) ;
317317
318318 let symbol : Symbol ;
319319 if ( name === undefined ) {
320- symbol = createSymbol ( SymbolFlags . None , "__missing" ) ;
320+ symbol = createSymbol ( SymbolFlags . None , InternalSymbolName . Missing ) ;
321321 }
322322 else {
323323 // Check and see if the symbol table already has a symbol with this name. If not,
@@ -1007,7 +1007,7 @@ namespace ts {
10071007 currentFlow = unreachableFlow ;
10081008 }
10091009
1010- function findActiveLabel ( name : UnderscoreEscapedString ) {
1010+ function findActiveLabel ( name : __String ) {
10111011 if ( activeLabels ) {
10121012 for ( const label of activeLabels ) {
10131013 if ( label . name === name ) {
@@ -1170,7 +1170,7 @@ namespace ts {
11701170 bindEach ( node . statements ) ;
11711171 }
11721172
1173- function pushActiveLabel ( name : UnderscoreEscapedString , breakTarget : FlowLabel , continueTarget : FlowLabel ) : ActiveLabel {
1173+ function pushActiveLabel ( name : __String , breakTarget : FlowLabel , continueTarget : FlowLabel ) : ActiveLabel {
11741174 const activeLabel = {
11751175 name,
11761176 breakTarget,
@@ -1646,7 +1646,7 @@ namespace ts {
16461646 const symbol = createSymbol ( SymbolFlags . Signature , getDeclarationName ( node ) ) ;
16471647 addDeclarationToSymbol ( symbol , node , SymbolFlags . Signature ) ;
16481648
1649- const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , "__type" ) ;
1649+ const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
16501650 addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
16511651 typeLiteralSymbol . members = createSymbolTable ( ) ;
16521652 typeLiteralSymbol . members . set ( symbol . name , symbol ) ;
@@ -1694,18 +1694,18 @@ namespace ts {
16941694 }
16951695 }
16961696
1697- return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , "__object" ) ;
1697+ return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , InternalSymbolName . Object ) ;
16981698 }
16991699
17001700 function bindJsxAttributes ( node : JsxAttributes ) {
1701- return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , "__jsxAttributes" ) ;
1701+ return bindAnonymousDeclaration ( node , SymbolFlags . ObjectLiteral , InternalSymbolName . JSXAttributes ) ;
17021702 }
17031703
17041704 function bindJsxAttribute ( node : JsxAttribute , symbolFlags : SymbolFlags , symbolExcludes : SymbolFlags ) {
17051705 return declareSymbolAndAddToSymbolTable ( node , symbolFlags , symbolExcludes ) ;
17061706 }
17071707
1708- function bindAnonymousDeclaration ( node : Declaration , symbolFlags : SymbolFlags , name : UnderscoreEscapedString ) {
1708+ function bindAnonymousDeclaration ( node : Declaration , symbolFlags : SymbolFlags , name : __String ) {
17091709 const symbol = createSymbol ( symbolFlags , name ) ;
17101710 addDeclarationToSymbol ( symbol , node , symbolFlags ) ;
17111711 }
@@ -1896,8 +1896,8 @@ namespace ts {
18961896 file . bindDiagnostics . push ( createFileDiagnostic ( file , span . start , span . length , message , arg0 , arg1 , arg2 ) ) ;
18971897 }
18981898
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 ;
19011901 }
19021902
19031903 function bind ( node : Node ) : void {
@@ -2191,7 +2191,7 @@ namespace ts {
21912191 }
21922192
21932193 function bindAnonymousTypeWorker ( node : TypeLiteralNode | MappedTypeNode | JSDocTypeLiteral | JSDocRecordType ) {
2194- return bindAnonymousDeclaration ( < Declaration > node , SymbolFlags . TypeLiteral , "__type" ) ;
2194+ return bindAnonymousDeclaration ( < Declaration > node , SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
21952195 }
21962196
21972197 function checkTypePredicate ( node : TypePredicateNode ) {
@@ -2213,7 +2213,7 @@ namespace ts {
22132213 }
22142214
22152215 function bindSourceFileAsExternalModule ( ) {
2216- bindAnonymousDeclaration ( file , SymbolFlags . ValueModule , `"${ removeFileExtension ( file . fileName ) } "` as UnderscoreEscapedString ) ;
2216+ bindAnonymousDeclaration ( file , SymbolFlags . ValueModule , `"${ removeFileExtension ( file . fileName ) } "` as __String ) ;
22172217 }
22182218
22192219 function bindExportAssignment ( node : ExportAssignment | BinaryExpression ) {
@@ -2404,11 +2404,11 @@ namespace ts {
24042404 }
24052405 }
24062406
2407- function lookupSymbolForName ( name : UnderscoreEscapedString ) {
2407+ function lookupSymbolForName ( name : __String ) {
24082408 return ( container . symbol && container . symbol . exports && container . symbol . exports . get ( name ) ) || ( container . locals && container . locals . get ( name ) ) ;
24092409 }
24102410
2411- function bindPropertyAssignment ( functionName : UnderscoreEscapedString , propertyAccessExpression : PropertyAccessExpression , isPrototypeProperty : boolean ) {
2411+ function bindPropertyAssignment ( functionName : __String , propertyAccessExpression : PropertyAccessExpression , isPrototypeProperty : boolean ) {
24122412 let targetSymbol = lookupSymbolForName ( functionName ) ;
24132413
24142414 if ( targetSymbol && isDeclarationOfFunctionOrClassExpression ( targetSymbol ) ) {
@@ -2441,7 +2441,7 @@ namespace ts {
24412441 bindBlockScopedDeclaration ( node , SymbolFlags . Class , SymbolFlags . ClassExcludes ) ;
24422442 }
24432443 else {
2444- const bindingName = node . name ? node . name . text : "__class" ;
2444+ const bindingName = node . name ? node . name . text : InternalSymbolName . Class ;
24452445 bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
24462446 // Add name of class expression into the map for semantic classifier
24472447 if ( node . name ) {
@@ -2460,7 +2460,7 @@ namespace ts {
24602460 // Note: we check for this here because this class may be merging into a module. The
24612461 // module might have an exported variable called 'prototype'. We can't allow that as
24622462 // 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 ) ;
24642464 const symbolExport = symbol . exports . get ( prototypeSymbol . name ) ;
24652465 if ( symbolExport ) {
24662466 if ( node . name ) {
@@ -2554,7 +2554,7 @@ namespace ts {
25542554 node . flowNode = currentFlow ;
25552555 }
25562556 checkStrictModeFunctionName ( node ) ;
2557- const bindingName = node . name ? node . name . text : "__function" ;
2557+ const bindingName = node . name ? node . name . text : InternalSymbolName . Function ;
25582558 return bindAnonymousDeclaration ( node , SymbolFlags . Function , bindingName ) ;
25592559 }
25602560
@@ -2568,7 +2568,7 @@ namespace ts {
25682568 }
25692569
25702570 return hasDynamicName ( node )
2571- ? bindAnonymousDeclaration ( node , symbolFlags , "__computed" )
2571+ ? bindAnonymousDeclaration ( node , symbolFlags , InternalSymbolName . Computed )
25722572 : declareSymbolAndAddToSymbolTable ( node , symbolFlags , symbolExcludes ) ;
25732573 }
25742574
0 commit comments