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

Function extract

__tests__/pascal-delphi-syntax.test.ts:38–47  ·  view source on GitHub ↗

Every routine's calls, as `Caller->Callee`, and every node's qualified name, from the unit's extraction.

(code: string, file: string)

Source from the content-addressed store, hash-verified

36
37/** Every routine's calls, as `Caller->Callee`, and every node's qualified name, from the unit's extraction. */
38function extract(code: string, file: string): { calls: string[]; names: string[] } {
39 const result = extractFromSource(file, code);
40 const byId = new Map(result.nodes.map((n) => [n.id, n]));
41 return {
42 calls: result.unresolvedReferences
43 .filter((r) => r.referenceKind === 'calls')
44 .map((r) => `${byId.get(r.fromNodeId)?.name}->${r.referenceName}`),
45 names: result.nodes.map((n) => n.qualifiedName),
46 };
47}
48
49const OVERRIDES = `unit Marks;
50

Callers 1

Calls 3

extractFromSourceFunction · 0.90
mapMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected