@@ -279,7 +279,7 @@ namespace ts.FindAllReferences.Core {
279279 if ( ! symbol ) {
280280 // String literal might be a property (and thus have a symbol), so do this here rather than in getReferencedSymbolsSpecial.
281281 if ( ! options . implementations && node . kind === SyntaxKind . StringLiteral ) {
282- return getReferencesForStringLiteral ( < StringLiteral > node , sourceFiles , checker , cancellationToken ) ;
282+ return getReferencesForStringLiteral ( < StringLiteral > node , sourceFiles , cancellationToken ) ;
283283 }
284284 // Can't have references to something that we have no symbol for.
285285 return undefined ;
@@ -1328,37 +1328,24 @@ namespace ts.FindAllReferences.Core {
13281328 }
13291329 }
13301330
1331- function getReferencesForStringLiteral ( node : StringLiteral , sourceFiles : SourceFile [ ] , checker : TypeChecker , cancellationToken : CancellationToken ) : SymbolAndEntries [ ] {
1332- const type = getStringLiteralTypeForNode ( node , checker ) ;
1333-
1334- if ( ! type ) {
1335- // nothing to do here. moving on
1336- return undefined ;
1337- }
1338-
1331+ function getReferencesForStringLiteral ( node : StringLiteral , sourceFiles : SourceFile [ ] , cancellationToken : CancellationToken ) : SymbolAndEntries [ ] {
13391332 const references : NodeEntry [ ] = [ ] ;
13401333
13411334 for ( const sourceFile of sourceFiles ) {
1342- const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , type . text , sourceFile . getStart ( ) , sourceFile . getEnd ( ) , cancellationToken ) ;
1343- getReferencesForStringLiteralInFile ( sourceFile , type , possiblePositions , references ) ;
1335+ cancellationToken . throwIfCancellationRequested ( ) ;
1336+ const possiblePositions = getPossibleSymbolReferencePositions ( sourceFile , node . text , sourceFile . getStart ( ) , sourceFile . getEnd ( ) , cancellationToken ) ;
1337+ getReferencesForStringLiteralInFile ( sourceFile , node . text , possiblePositions , references ) ;
13441338 }
13451339
13461340 return [ {
13471341 definition : { type : "string" , node } ,
13481342 references
13491343 } ] ;
13501344
1351- function getReferencesForStringLiteralInFile ( sourceFile : SourceFile , searchType : Type , possiblePositions : number [ ] , references : Push < NodeEntry > ) : void {
1345+ function getReferencesForStringLiteralInFile ( sourceFile : SourceFile , searchText : string , possiblePositions : number [ ] , references : Push < NodeEntry > ) : void {
13521346 for ( const position of possiblePositions ) {
1353- cancellationToken . throwIfCancellationRequested ( ) ;
1354-
13551347 const node = getTouchingWord ( sourceFile , position ) ;
1356- if ( ! node || node . kind !== SyntaxKind . StringLiteral ) {
1357- return ;
1358- }
1359-
1360- const type = getStringLiteralTypeForNode ( < StringLiteral > node , checker ) ;
1361- if ( type === searchType ) {
1348+ if ( node && node . kind === SyntaxKind . StringLiteral && ( node as StringLiteral ) . text === searchText ) {
13621349 references . push ( nodeEntry ( node , /*isInString*/ true ) ) ;
13631350 }
13641351 }
0 commit comments