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

Function resolveByReceiver

src/ui-server/api/steps.ts:567–577  ·  view source on GitHub ↗
(caller: Node, callee: string)

Source from the content-addressed store, hash-verified

565 return known;
566 };
567 const resolveByReceiver = async (caller: Node, callee: string): Promise<Node | null> => {
568 const segments = callee.replace(/\([^()]*\)/g, '').split(/[.:]+/).filter(Boolean);
569 if (segments.length < 2) return null;
570 const type = await receiverTypeFor(caller, callee);
571 if (!type) return null;
572 const cls = await classOfType(type);
573 if (!cls) return null;
574 const method = segments[segments.length - 1]!;
575 const members = cg.getNodesInFile(cls.filePath).filter((n) => (n.kind === 'method' || n.kind === 'function') && n.name === method && n.startLine >= cls!.startLine && n.endLine <= cls!.endLine);
576 return members[0] ?? null;
577 };
578
579 /**
580 * A name-match that the call as written disproves: the target is a method of

Callers 2

effectLinkFunction · 0.85
buildStepsFunction · 0.85

Calls 3

receiverTypeForFunction · 0.85
classOfTypeFunction · 0.85
getNodesInFileMethod · 0.65

Tested by

no test coverage detected