@@ -242,7 +242,7 @@ namespace ts {
242242 }
243243
244244 Debug . assert ( isWellKnownSymbolSyntactically ( nameExpression ) ) ;
245- return getPropertyNameForKnownSymbolName ( unescapeLeadingUnderscores ( ( < PropertyAccessExpression > nameExpression ) . name . text ) ) ;
245+ return getPropertyNameForKnownSymbolName ( unescapeLeadingUnderscores ( ( < PropertyAccessExpression > nameExpression ) . name . escapedText ) ) ;
246246 }
247247 return getEscapedTextOfIdentifierOrLiteral ( < Identifier | LiteralExpression > name ) ;
248248 }
@@ -287,8 +287,8 @@ namespace ts {
287287 if ( parentNode && parentNode . kind === SyntaxKind . VariableStatement ) {
288288 if ( ( < VariableStatement > parentNode ) . declarationList . declarations . length > 0 ) {
289289 const nameIdentifier = ( < VariableStatement > parentNode ) . declarationList . declarations [ 0 ] . name ;
290- if ( nameIdentifier . kind === SyntaxKind . Identifier ) {
291- nameFromParentNode = ( < Identifier > nameIdentifier ) . text ;
290+ if ( isIdentifier ( nameIdentifier ) ) {
291+ nameFromParentNode = nameIdentifier . escapedText ;
292292 }
293293 }
294294 }
@@ -1031,7 +1031,7 @@ namespace ts {
10311031 function bindBreakOrContinueStatement ( node : BreakOrContinueStatement ) : void {
10321032 bind ( node . label ) ;
10331033 if ( node . label ) {
1034- const activeLabel = findActiveLabel ( node . label . text ) ;
1034+ const activeLabel = findActiveLabel ( node . label . escapedText ) ;
10351035 if ( activeLabel ) {
10361036 activeLabel . referenced = true ;
10371037 bindBreakOrContinueFlow ( node , activeLabel . breakTarget , activeLabel . continueTarget ) ;
@@ -1192,7 +1192,7 @@ namespace ts {
11921192 const postStatementLabel = createBranchLabel ( ) ;
11931193 bind ( node . label ) ;
11941194 addAntecedent ( preStatementLabel , currentFlow ) ;
1195- const activeLabel = pushActiveLabel ( node . label . text , postStatementLabel , preStatementLabel ) ;
1195+ const activeLabel = pushActiveLabel ( node . label . escapedText , postStatementLabel , preStatementLabel ) ;
11961196 bind ( node . statement ) ;
11971197 popActiveLabel ( ) ;
11981198 if ( ! activeLabel . referenced && ! options . allowUnusedLabels ) {
@@ -1649,7 +1649,7 @@ namespace ts {
16491649 const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
16501650 addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
16511651 typeLiteralSymbol . members = createSymbolTable ( ) ;
1652- typeLiteralSymbol . members . set ( symbol . name , symbol ) ;
1652+ typeLiteralSymbol . members . set ( symbol . escapedName , symbol ) ;
16531653 }
16541654
16551655 function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1680,9 +1680,9 @@ namespace ts {
16801680 ? ElementKind . Property
16811681 : ElementKind . Accessor ;
16821682
1683- const existingKind = seen . get ( identifier . text ) ;
1683+ const existingKind = seen . get ( identifier . escapedText ) ;
16841684 if ( ! existingKind ) {
1685- seen . set ( identifier . text , currentKind ) ;
1685+ seen . set ( identifier . escapedText , currentKind ) ;
16861686 continue ;
16871687 }
16881688
@@ -1792,8 +1792,7 @@ namespace ts {
17921792 }
17931793
17941794 function isEvalOrArgumentsIdentifier ( node : Node ) : boolean {
1795- return node . kind === SyntaxKind . Identifier &&
1796- ( ( < Identifier > node ) . text === "eval" || ( < Identifier > node ) . text === "arguments" ) ;
1795+ return isIdentifier ( node ) && ( node . escapedText === "eval" || node . escapedText === "arguments" ) ;
17971796 }
17981797
17991798 function checkStrictModeEvalOrArguments ( contextNode : Node , name : Node ) {
@@ -1804,7 +1803,7 @@ namespace ts {
18041803 // otherwise report generic error message.
18051804 const span = getErrorSpanForNode ( file , name ) ;
18061805 file . bindDiagnostics . push ( createFileDiagnostic ( file , span . start , span . length ,
1807- getStrictModeEvalOrArgumentsMessage ( contextNode ) , unescapeLeadingUnderscores ( identifier . text ) ) ) ;
1806+ getStrictModeEvalOrArgumentsMessage ( contextNode ) , unescapeLeadingUnderscores ( identifier . escapedText ) ) ) ;
18081807 }
18091808 }
18101809 }
@@ -2300,14 +2299,10 @@ namespace ts {
23002299 }
23012300
23022301 function isNameOfExportsOrModuleExportsAliasDeclaration ( node : Node ) {
2303- if ( node . kind === SyntaxKind . Identifier ) {
2304- const symbol = lookupSymbolForName ( ( < Identifier > node ) . text ) ;
2305- if ( symbol && symbol . valueDeclaration && symbol . valueDeclaration . kind === SyntaxKind . VariableDeclaration ) {
2306- const declaration = symbol . valueDeclaration as VariableDeclaration ;
2307- if ( declaration . initializer ) {
2308- return isExportsOrModuleExportsOrAliasOrAssignment ( declaration . initializer ) ;
2309- }
2310- }
2302+ if ( isIdentifier ( node ) ) {
2303+ const symbol = lookupSymbolForName ( node . escapedText ) ;
2304+ return symbol && symbol . valueDeclaration && isVariableDeclaration ( symbol . valueDeclaration ) &&
2305+ symbol . valueDeclaration . initializer && isExportsOrModuleExportsOrAliasOrAssignment ( symbol . valueDeclaration . initializer ) ;
23112306 }
23122307 return false ;
23132308 }
@@ -2374,7 +2369,7 @@ namespace ts {
23742369 constructorFunction . parent = classPrototype ;
23752370 classPrototype . parent = leftSideOfAssignment ;
23762371
2377- bindPropertyAssignment ( constructorFunction . text , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
2372+ bindPropertyAssignment ( constructorFunction . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
23782373 }
23792374
23802375 function bindStaticPropertyAssignment ( node : BinaryExpression ) {
@@ -2396,7 +2391,7 @@ namespace ts {
23962391 bindExportsPropertyAssignment ( node ) ;
23972392 }
23982393 else {
2399- bindPropertyAssignment ( target . text , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2394+ bindPropertyAssignment ( target . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
24002395 }
24012396 }
24022397
@@ -2437,11 +2432,11 @@ namespace ts {
24372432 bindBlockScopedDeclaration ( node , SymbolFlags . Class , SymbolFlags . ClassExcludes ) ;
24382433 }
24392434 else {
2440- const bindingName = node . name ? node . name . text : InternalSymbolName . Class ;
2435+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Class ;
24412436 bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
24422437 // Add name of class expression into the map for semantic classifier
24432438 if ( node . name ) {
2444- classifiableNames . set ( node . name . text , true ) ;
2439+ classifiableNames . set ( node . name . escapedText , true ) ;
24452440 }
24462441 }
24472442
@@ -2457,14 +2452,14 @@ namespace ts {
24572452 // module might have an exported variable called 'prototype'. We can't allow that as
24582453 // that would clash with the built-in 'prototype' for the class.
24592454 const prototypeSymbol = createSymbol ( SymbolFlags . Property | SymbolFlags . Prototype , "prototype" as __String ) ;
2460- const symbolExport = symbol . exports . get ( prototypeSymbol . name ) ;
2455+ const symbolExport = symbol . exports . get ( prototypeSymbol . escapedName ) ;
24612456 if ( symbolExport ) {
24622457 if ( node . name ) {
24632458 node . name . parent = node ;
24642459 }
2465- file . bindDiagnostics . push ( createDiagnosticForNode ( symbolExport . declarations [ 0 ] , Diagnostics . Duplicate_identifier_0 , unescapeLeadingUnderscores ( prototypeSymbol . name ) ) ) ;
2460+ file . bindDiagnostics . push ( createDiagnosticForNode ( symbolExport . declarations [ 0 ] , Diagnostics . Duplicate_identifier_0 , unescapeLeadingUnderscores ( prototypeSymbol . escapedName ) ) ) ;
24662461 }
2467- symbol . exports . set ( prototypeSymbol . name , prototypeSymbol ) ;
2462+ symbol . exports . set ( prototypeSymbol . escapedName , prototypeSymbol ) ;
24682463 prototypeSymbol . parent = symbol ;
24692464 }
24702465
@@ -2550,7 +2545,7 @@ namespace ts {
25502545 node . flowNode = currentFlow ;
25512546 }
25522547 checkStrictModeFunctionName ( node ) ;
2553- const bindingName = node . name ? node . name . text : InternalSymbolName . Function ;
2548+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Function ;
25542549 return bindAnonymousDeclaration ( node , SymbolFlags . Function , bindingName ) ;
25552550 }
25562551
0 commit comments