@@ -44,17 +44,27 @@ export class CInvocationResolver {
4444 } ;
4545 }
4646
47+ getInvocationsForSymbol ( symbol : Symbol ) {
48+ let filepath = symbol . declaration . filepath ;
49+ let node = symbol . declaration . node ;
50+ if ( symbol instanceof Function ) {
51+ filepath = symbol . definitionPath ;
52+ node = symbol . definition ;
53+ }
54+ const name = symbol . name ;
55+ const invocations = this . getInvocationsForNode ( node , filepath , name ) ;
56+ return {
57+ resolved : invocations . resolved ,
58+ unresolved : invocations . unresolved ,
59+ } ;
60+ }
61+
4762 getInvocationsForFile ( filepath : string ) : Invocations {
4863 const symbols = this . includeResolver . symbolRegistry . get ( filepath ) . symbols ;
4964 let unresolved = new Set < string > ( ) ;
5065 const resolved = new Map < string , Symbol > ( ) ;
5166 for ( const symbol of symbols . values ( ) ) {
52- const node =
53- symbol instanceof Function
54- ? ( symbol as Function ) . definition
55- : symbol . declaration . node ;
56- const name = symbol . name ;
57- const invocations = this . getInvocationsForNode ( node , filepath , name ) ;
67+ const invocations = this . getInvocationsForSymbol ( symbol ) ;
5868 unresolved = new Set ( [ ...unresolved , ...invocations . unresolved ] ) ;
5969 for ( const [ key , value ] of invocations . resolved ) {
6070 if ( ! resolved . has ( key ) ) {
0 commit comments