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

Function targetsOf

src/resolution/callback-synthesizer.ts:3267–3282  ·  view source on GitHub ↗
(behaviour: Node, fn: string)

Source from the content-addressed store, hash-verified

3265 // implementer module's own exported `fn` function node.
3266 const targetCache = new Map<string, Node[]>();
3267 const targetsOf = (behaviour: Node, fn: string): Node[] => {
3268 const cacheKey = `${behaviour.id}#${fn}`;
3269 let targets = targetCache.get(cacheKey);
3270 if (targets) return targets;
3271 targets = [];
3272 for (const e of queries.getIncomingEdges(behaviour.id, ['implements'])) {
3273 const impl = queries.getNodeById(e.source);
3274 if (!impl || impl.language !== 'erlang' || impl.kind !== 'namespace') continue;
3275 const fnNode = ctx
3276 .getNodesInFile(impl.filePath)
3277 .find((n) => n.kind === 'function' && n.name === fn && n.isExported !== false);
3278 if (fnNode) targets.push(fnNode);
3279 }
3280 targetCache.set(cacheKey, targets);
3281 return targets;
3282 };
3283
3284 // Pass 2 — dispatch sites. Only files containing a var-module call shape are
3285 // scanned in full.

Callers 1

Calls 5

getMethod · 0.65
getNodeByIdMethod · 0.65
getNodesInFileMethod · 0.65
getIncomingEdgesMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected