MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / callSitesForFile

Function callSitesForFile

src/graph/branch-guards.ts:616–632  ·  view source on GitHub ↗
(
  absPath: string,
  language: Language,
  sites: readonly CallSite[]
)

Source from the content-addressed store, hash-verified

614
615/** Both halves of every site, keyed by {@link siteKey}, from one cached tree. */
616export async function callSitesForFile(
617 absPath: string,
618 language: Language,
619 sites: readonly CallSite[]
620): Promise<Map<string, CallSiteText>> {
621 const out = new Map<string, CallSiteText>();
622 if (!supportsBranchGuards(language) || sites.length === 0) return out;
623 const cached = await treeFor(absPath, language);
624 if (!cached) return out;
625 for (const site of sites) {
626 const key = siteKey(site);
627 if (out.has(key)) continue;
628 const found = callSiteInTree(cached.tree.rootNode, cached.source, site.line, site.column ?? null, site.callee);
629 if (found !== null) out.set(key, found);
630 }
631 return out;
632}
633
634/** {@link callSitesForFile} over source text — the test surface. */
635export async function callSiteInSource(

Callers 1

callSiteFunction · 0.90

Calls 6

supportsBranchGuardsFunction · 0.85
treeForFunction · 0.85
siteKeyFunction · 0.85
callSiteInTreeFunction · 0.85
hasMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected