Skip to content

Commit 6d6cdac

Browse files
author
Andy Hanson
committed
Handle escaped identifiers
1 parent 20a70f9 commit 6d6cdac

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/compiler/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,11 @@ namespace ts {
571571

572572
export interface Identifier extends PrimaryExpression {
573573
kind: SyntaxKind.Identifier;
574-
text: string; // Text of identifier (with escapes converted to characters)
574+
/**
575+
* Text of identifier (with escapes converted to characters).
576+
* If the identifier begins with two underscores, this will begin with three.
577+
*/
578+
text: string;
575579
originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
576580
/*@internal*/ autoGenerateKind?: GeneratedIdentifierKind; // Specifies whether to auto-generate the text for an identifier.
577581
/*@internal*/ autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name.

src/services/findAllReferences.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ namespace ts.FindAllReferences.Core {
694694
// Compare the length so we filter out strict superstrings of the symbol we are looking for
695695
switch (node && node.kind) {
696696
case SyntaxKind.Identifier:
697-
return (node as Identifier).text.length === searchSymbolName.length;
697+
return unescapeIdentifier((node as Identifier).text).length === searchSymbolName.length;
698698

699699
case SyntaxKind.StringLiteral:
700700
return (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) &&

0 commit comments

Comments
 (0)