@@ -242,7 +242,7 @@ namespace ts {
242
242
}
243
243
244
244
Debug . assert ( isWellKnownSymbolSyntactically ( nameExpression ) ) ;
245
- return getPropertyNameForKnownSymbolName ( unescapeLeadingUnderscores ( ( < PropertyAccessExpression > nameExpression ) . name . text ) ) ;
245
+ return getPropertyNameForKnownSymbolName ( unescapeLeadingUnderscores ( ( < PropertyAccessExpression > nameExpression ) . name . escapedText ) ) ;
246
246
}
247
247
return getEscapedTextOfIdentifierOrLiteral ( < Identifier | LiteralExpression > name ) ;
248
248
}
@@ -287,8 +287,8 @@ namespace ts {
287
287
if ( parentNode && parentNode . kind === SyntaxKind . VariableStatement ) {
288
288
if ( ( < VariableStatement > parentNode ) . declarationList . declarations . length > 0 ) {
289
289
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 ;
292
292
}
293
293
}
294
294
}
@@ -1031,7 +1031,7 @@ namespace ts {
1031
1031
function bindBreakOrContinueStatement ( node : BreakOrContinueStatement ) : void {
1032
1032
bind ( node . label ) ;
1033
1033
if ( node . label ) {
1034
- const activeLabel = findActiveLabel ( node . label . text ) ;
1034
+ const activeLabel = findActiveLabel ( node . label . escapedText ) ;
1035
1035
if ( activeLabel ) {
1036
1036
activeLabel . referenced = true ;
1037
1037
bindBreakOrContinueFlow ( node , activeLabel . breakTarget , activeLabel . continueTarget ) ;
@@ -1192,7 +1192,7 @@ namespace ts {
1192
1192
const postStatementLabel = createBranchLabel ( ) ;
1193
1193
bind ( node . label ) ;
1194
1194
addAntecedent ( preStatementLabel , currentFlow ) ;
1195
- const activeLabel = pushActiveLabel ( node . label . text , postStatementLabel , preStatementLabel ) ;
1195
+ const activeLabel = pushActiveLabel ( node . label . escapedText , postStatementLabel , preStatementLabel ) ;
1196
1196
bind ( node . statement ) ;
1197
1197
popActiveLabel ( ) ;
1198
1198
if ( ! activeLabel . referenced && ! options . allowUnusedLabels ) {
@@ -1649,7 +1649,7 @@ namespace ts {
1649
1649
const typeLiteralSymbol = createSymbol ( SymbolFlags . TypeLiteral , InternalSymbolName . Type ) ;
1650
1650
addDeclarationToSymbol ( typeLiteralSymbol , node , SymbolFlags . TypeLiteral ) ;
1651
1651
typeLiteralSymbol . members = createSymbolTable ( ) ;
1652
- typeLiteralSymbol . members . set ( symbol . name , symbol ) ;
1652
+ typeLiteralSymbol . members . set ( symbol . escapedName , symbol ) ;
1653
1653
}
1654
1654
1655
1655
function bindObjectLiteralExpression ( node : ObjectLiteralExpression ) {
@@ -1680,9 +1680,9 @@ namespace ts {
1680
1680
? ElementKind . Property
1681
1681
: ElementKind . Accessor ;
1682
1682
1683
- const existingKind = seen . get ( identifier . text ) ;
1683
+ const existingKind = seen . get ( identifier . escapedText ) ;
1684
1684
if ( ! existingKind ) {
1685
- seen . set ( identifier . text , currentKind ) ;
1685
+ seen . set ( identifier . escapedText , currentKind ) ;
1686
1686
continue ;
1687
1687
}
1688
1688
@@ -1792,8 +1792,7 @@ namespace ts {
1792
1792
}
1793
1793
1794
1794
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" ) ;
1797
1796
}
1798
1797
1799
1798
function checkStrictModeEvalOrArguments ( contextNode : Node , name : Node ) {
@@ -1804,7 +1803,7 @@ namespace ts {
1804
1803
// otherwise report generic error message.
1805
1804
const span = getErrorSpanForNode ( file , name ) ;
1806
1805
file . bindDiagnostics . push ( createFileDiagnostic ( file , span . start , span . length ,
1807
- getStrictModeEvalOrArgumentsMessage ( contextNode ) , unescapeLeadingUnderscores ( identifier . text ) ) ) ;
1806
+ getStrictModeEvalOrArgumentsMessage ( contextNode ) , unescapeLeadingUnderscores ( identifier . escapedText ) ) ) ;
1808
1807
}
1809
1808
}
1810
1809
}
@@ -2300,14 +2299,10 @@ namespace ts {
2300
2299
}
2301
2300
2302
2301
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 ) ;
2311
2306
}
2312
2307
return false ;
2313
2308
}
@@ -2374,7 +2369,7 @@ namespace ts {
2374
2369
constructorFunction . parent = classPrototype ;
2375
2370
classPrototype . parent = leftSideOfAssignment ;
2376
2371
2377
- bindPropertyAssignment ( constructorFunction . text , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
2372
+ bindPropertyAssignment ( constructorFunction . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
2378
2373
}
2379
2374
2380
2375
function bindStaticPropertyAssignment ( node : BinaryExpression ) {
@@ -2396,7 +2391,7 @@ namespace ts {
2396
2391
bindExportsPropertyAssignment ( node ) ;
2397
2392
}
2398
2393
else {
2399
- bindPropertyAssignment ( target . text , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2394
+ bindPropertyAssignment ( target . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2400
2395
}
2401
2396
}
2402
2397
@@ -2437,11 +2432,11 @@ namespace ts {
2437
2432
bindBlockScopedDeclaration ( node , SymbolFlags . Class , SymbolFlags . ClassExcludes ) ;
2438
2433
}
2439
2434
else {
2440
- const bindingName = node . name ? node . name . text : InternalSymbolName . Class ;
2435
+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Class ;
2441
2436
bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
2442
2437
// Add name of class expression into the map for semantic classifier
2443
2438
if ( node . name ) {
2444
- classifiableNames . set ( node . name . text , true ) ;
2439
+ classifiableNames . set ( node . name . escapedText , true ) ;
2445
2440
}
2446
2441
}
2447
2442
@@ -2457,14 +2452,14 @@ namespace ts {
2457
2452
// module might have an exported variable called 'prototype'. We can't allow that as
2458
2453
// that would clash with the built-in 'prototype' for the class.
2459
2454
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 ) ;
2461
2456
if ( symbolExport ) {
2462
2457
if ( node . name ) {
2463
2458
node . name . parent = node ;
2464
2459
}
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 ) ) ) ;
2466
2461
}
2467
- symbol . exports . set ( prototypeSymbol . name , prototypeSymbol ) ;
2462
+ symbol . exports . set ( prototypeSymbol . escapedName , prototypeSymbol ) ;
2468
2463
prototypeSymbol . parent = symbol ;
2469
2464
}
2470
2465
@@ -2550,7 +2545,7 @@ namespace ts {
2550
2545
node . flowNode = currentFlow ;
2551
2546
}
2552
2547
checkStrictModeFunctionName ( node ) ;
2553
- const bindingName = node . name ? node . name . text : InternalSymbolName . Function ;
2548
+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Function ;
2554
2549
return bindAnonymousDeclaration ( node , SymbolFlags . Function , bindingName ) ;
2555
2550
}
2556
2551
0 commit comments