@@ -130,8 +130,7 @@ namespace ts.FindAllReferences {
130130
131131 const { node, name, kind, displayParts } = info ;
132132 const sourceFile = node . getSourceFile ( ) ;
133- const textSpan = getTextSpan ( isComputedPropertyName ( node ) ? node . expression : node , sourceFile ) ;
134- return { containerKind : ScriptElementKind . unknown , containerName : "" , fileName : sourceFile . fileName , kind, name, textSpan, displayParts } ;
133+ return { containerKind : ScriptElementKind . unknown , containerName : "" , fileName : sourceFile . fileName , kind, name, textSpan : getTextSpan ( isComputedPropertyName ( node ) ? node . expression : node , sourceFile ) , displayParts } ;
135134 }
136135
137136 function getDefinitionKindAndDisplayParts ( symbol : Symbol , checker : TypeChecker , node : Node ) : { displayParts : SymbolDisplayPart [ ] , kind : ScriptElementKind } {
@@ -148,21 +147,23 @@ namespace ts.FindAllReferences {
148147 }
149148
150149 const { node, isInString } = entry ;
150+ const sourceFile = node . getSourceFile ( ) ;
151151 return {
152- fileName : node . getSourceFile ( ) . fileName ,
153- textSpan : getTextSpan ( node ) ,
152+ fileName : sourceFile . fileName ,
153+ textSpan : getTextSpan ( node , sourceFile ) ,
154154 isWriteAccess : isWriteAccessForReference ( node ) ,
155155 isDefinition : node . kind === SyntaxKind . DefaultKeyword
156156 || isAnyDeclarationName ( node )
157157 || isLiteralComputedPropertyDeclarationName ( node ) ,
158- isInString
158+ isInString,
159159 } ;
160160 }
161161
162162 function toImplementationLocation ( entry : Entry , checker : TypeChecker ) : ImplementationLocation {
163163 if ( entry . type === "node" ) {
164164 const { node } = entry ;
165- return { textSpan : getTextSpan ( node ) , fileName : node . getSourceFile ( ) . fileName , ...implementationKindDisplayParts ( node , checker ) } ;
165+ const sourceFile = node . getSourceFile ( ) ;
166+ return { textSpan : getTextSpan ( node , sourceFile ) , fileName : sourceFile . fileName , ...implementationKindDisplayParts ( node , checker ) } ;
166167 }
167168 else {
168169 const { textSpan, fileName } = entry ;
@@ -199,17 +200,17 @@ namespace ts.FindAllReferences {
199200 }
200201
201202 const { node, isInString } = entry ;
202- const fileName = entry . node . getSourceFile ( ) . fileName ;
203+ const sourceFile = node . getSourceFile ( ) ;
203204 const writeAccess = isWriteAccessForReference ( node ) ;
204205 const span : HighlightSpan = {
205- textSpan : getTextSpan ( node ) ,
206+ textSpan : getTextSpan ( node , sourceFile ) ,
206207 kind : writeAccess ? HighlightSpanKind . writtenReference : HighlightSpanKind . reference ,
207208 isInString
208209 } ;
209- return { fileName, span } ;
210+ return { fileName : sourceFile . fileName , span } ;
210211 }
211212
212- function getTextSpan ( node : Node , sourceFile ? : SourceFile ) : TextSpan {
213+ function getTextSpan ( node : Node , sourceFile : SourceFile ) : TextSpan {
213214 let start = node . getStart ( sourceFile ) ;
214215 let end = node . getEnd ( ) ;
215216 if ( node . kind === SyntaxKind . StringLiteral ) {
0 commit comments