@@ -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 ) {
@@ -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
}
@@ -2295,14 +2294,10 @@ namespace ts {
2295
2294
}
2296
2295
2297
2296
function isNameOfExportsOrModuleExportsAliasDeclaration ( node : Node ) {
2298
- if ( node . kind === SyntaxKind . Identifier ) {
2299
- const symbol = lookupSymbolForName ( ( < Identifier > node ) . text ) ;
2300
- if ( symbol && symbol . valueDeclaration && symbol . valueDeclaration . kind === SyntaxKind . VariableDeclaration ) {
2301
- const declaration = symbol . valueDeclaration as VariableDeclaration ;
2302
- if ( declaration . initializer ) {
2303
- return isExportsOrModuleExportsOrAliasOrAssignment ( declaration . initializer ) ;
2304
- }
2305
- }
2297
+ if ( isIdentifier ( node ) ) {
2298
+ const symbol = lookupSymbolForName ( node . escapedText ) ;
2299
+ return symbol && symbol . valueDeclaration && isVariableDeclaration ( symbol . valueDeclaration ) &&
2300
+ symbol . valueDeclaration . initializer && isExportsOrModuleExportsOrAliasOrAssignment ( symbol . valueDeclaration . initializer ) ;
2306
2301
}
2307
2302
return false ;
2308
2303
}
@@ -2369,7 +2364,7 @@ namespace ts {
2369
2364
constructorFunction . parent = classPrototype ;
2370
2365
classPrototype . parent = leftSideOfAssignment ;
2371
2366
2372
- bindPropertyAssignment ( constructorFunction . text , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
2367
+ bindPropertyAssignment ( constructorFunction . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ true ) ;
2373
2368
}
2374
2369
2375
2370
function bindStaticPropertyAssignment ( node : BinaryExpression ) {
@@ -2391,7 +2386,7 @@ namespace ts {
2391
2386
bindExportsPropertyAssignment ( node ) ;
2392
2387
}
2393
2388
else {
2394
- bindPropertyAssignment ( target . text , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2389
+ bindPropertyAssignment ( target . escapedText , leftSideOfAssignment , /*isPrototypeProperty*/ false ) ;
2395
2390
}
2396
2391
}
2397
2392
@@ -2432,11 +2427,11 @@ namespace ts {
2432
2427
bindBlockScopedDeclaration ( node , SymbolFlags . Class , SymbolFlags . ClassExcludes ) ;
2433
2428
}
2434
2429
else {
2435
- const bindingName = node . name ? node . name . text : InternalSymbolName . Class ;
2430
+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Class ;
2436
2431
bindAnonymousDeclaration ( node , SymbolFlags . Class , bindingName ) ;
2437
2432
// Add name of class expression into the map for semantic classifier
2438
2433
if ( node . name ) {
2439
- classifiableNames . set ( node . name . text , true ) ;
2434
+ classifiableNames . set ( node . name . escapedText , true ) ;
2440
2435
}
2441
2436
}
2442
2437
@@ -2545,7 +2540,7 @@ namespace ts {
2545
2540
node . flowNode = currentFlow ;
2546
2541
}
2547
2542
checkStrictModeFunctionName ( node ) ;
2548
- const bindingName = node . name ? node . name . text : InternalSymbolName . Function ;
2543
+ const bindingName = node . name ? node . name . escapedText : InternalSymbolName . Function ;
2549
2544
return bindAnonymousDeclaration ( node , SymbolFlags . Function , bindingName ) ;
2550
2545
}
2551
2546
0 commit comments