Handle escaped identifiers

This commit is contained in:
Andy Hanson 2017-05-11 12:22:10 -07:00
parent 20a70f99b1
commit 6d6cdac645
2 changed files with 6 additions and 2 deletions

View File

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

View File

@ -694,7 +694,7 @@ namespace ts.FindAllReferences.Core {
// Compare the length so we filter out strict superstrings of the symbol we are looking for
switch (node && node.kind) {
case SyntaxKind.Identifier:
return (node as Identifier).text.length === searchSymbolName.length;
return unescapeIdentifier((node as Identifier).text).length === searchSymbolName.length;
case SyntaxKind.StringLiteral:
return (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) &&