@@ -29,7 +29,8 @@ export class SymbolBuilder {
2929 private symbolCache = new Map < AST | TmplAstNode , Symbol | null > ( ) ;
3030
3131 constructor (
32- private readonly shimPath : AbsoluteFsPath ,
32+ private readonly tcbPath : AbsoluteFsPath ,
33+ private readonly tcbIsShim : boolean ,
3334 private readonly typeCheckBlock : ts . Node ,
3435 private readonly templateData : TemplateData ,
3536 private readonly componentScopeReader : ComponentScopeReader ,
@@ -233,7 +234,7 @@ export class SymbolBuilder {
233234 const addEventListener = outputFieldAccess . name ;
234235 const tsSymbol = this . getTypeChecker ( ) . getSymbolAtLocation ( addEventListener ) ;
235236 const tsType = this . getTypeChecker ( ) . getTypeAtLocation ( addEventListener ) ;
236- const positionInShimFile = this . getShimPositionForNode ( addEventListener ) ;
237+ const positionInFile = this . getTcbPositionForNode ( addEventListener ) ;
237238 const target = this . getSymbol ( consumer ) ;
238239
239240 if ( target === null || tsSymbol === undefined ) {
@@ -245,7 +246,11 @@ export class SymbolBuilder {
245246 tsSymbol,
246247 tsType,
247248 target,
248- tcbLocation : { tcbPath : this . shimPath , positionInFile : positionInShimFile } ,
249+ tcbLocation : {
250+ tcbPath : this . tcbPath ,
251+ isShimFile : this . tcbIsShim ,
252+ positionInFile,
253+ } ,
249254 } ) ;
250255 } else {
251256 if ( ! ts . isElementAccessExpression ( outputFieldAccess ) ) {
@@ -263,14 +268,18 @@ export class SymbolBuilder {
263268 continue ;
264269 }
265270
266- const positionInShimFile = this . getShimPositionForNode ( outputFieldAccess ) ;
271+ const positionInFile = this . getTcbPositionForNode ( outputFieldAccess ) ;
267272 const tsType = this . getTypeChecker ( ) . getTypeAtLocation ( outputFieldAccess ) ;
268273 bindings . push ( {
269274 kind : SymbolKind . Binding ,
270275 tsSymbol,
271276 tsType,
272277 target,
273- tcbLocation : { tcbPath : this . shimPath , positionInFile : positionInShimFile } ,
278+ tcbLocation : {
279+ tcbPath : this . tcbPath ,
280+ isShimFile : this . tcbIsShim ,
281+ positionInFile,
282+ } ,
274283 } ) ;
275284 }
276285 }
@@ -383,8 +392,9 @@ export class SymbolBuilder {
383392 kind : SymbolKind . Variable ,
384393 declaration : variable ,
385394 localVarLocation : {
386- tcbPath : this . shimPath ,
387- positionInFile : this . getShimPositionForNode ( node . name ) ,
395+ tcbPath : this . tcbPath ,
396+ isShimFile : this . tcbIsShim ,
397+ positionInFile : this . getTcbPositionForNode ( node . name ) ,
388398 }
389399 } ;
390400 }
@@ -415,8 +425,9 @@ export class SymbolBuilder {
415425 }
416426
417427 const referenceVarTcbLocation : TcbLocation = {
418- tcbPath : this . shimPath ,
419- positionInFile : this . getShimPositionForNode ( node ) ,
428+ tcbPath : this . tcbPath ,
429+ isShimFile : this . tcbIsShim ,
430+ positionInFile : this . getTcbPositionForNode ( node ) ,
420431 } ;
421432 if ( target instanceof TmplAstTemplate || target instanceof TmplAstElement ) {
422433 return {
@@ -561,21 +572,25 @@ export class SymbolBuilder {
561572 tsSymbol = this . getTypeChecker ( ) . getSymbolAtLocation ( node ) ;
562573 }
563574
564- const positionInShimFile = this . getShimPositionForNode ( node ) ;
575+ const positionInFile = this . getTcbPositionForNode ( node ) ;
565576 const type = this . getTypeChecker ( ) . getTypeAtLocation ( node ) ;
566577 return {
567578 // If we could not find a symbol, fall back to the symbol on the type for the node.
568579 // Some nodes won't have a "symbol at location" but will have a symbol for the type.
569580 // Examples of this would be literals and `document.createElement('div')`.
570581 tsSymbol : tsSymbol ?? type . symbol ?? null ,
571582 tsType : type ,
572- tcbLocation : { tcbPath : this . shimPath , positionInFile : positionInShimFile } ,
583+ tcbLocation : {
584+ tcbPath : this . tcbPath ,
585+ isShimFile : this . tcbIsShim ,
586+ positionInFile,
587+ } ,
573588 } ;
574589 }
575590
576- private getShimPositionForNode ( node : ts . Node ) : number {
591+ private getTcbPositionForNode ( node : ts . Node ) : number {
577592 if ( ts . isTypeReferenceNode ( node ) ) {
578- return this . getShimPositionForNode ( node . typeName ) ;
593+ return this . getTcbPositionForNode ( node . typeName ) ;
579594 } else if ( ts . isQualifiedName ( node ) ) {
580595 return node . right . getStart ( ) ;
581596 } else if ( ts . isPropertyAccessExpression ( node ) ) {
0 commit comments