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

Function takes

__tests__/rust-use-scopes.test.ts:99–104  ·  view source on GitHub ↗
(file: string, name: string)

Source from the content-addressed store, hash-verified

97
98/** The files of the functions named `take` that the function `name` in `file` calls. */
99const takes = (file: string, name: string): string[] => {
100 const caller = cg.getNodesInFile(file).find((n) => n.name === name && n.kind === 'function');
101 expect(caller, `${file}:${name}`).toBeDefined();
102 return cg.getOutgoingEdgesFrom([caller!.id]).filter((e) => e.kind === 'calls')
103 .map((e) => cg.getNode(e.target)!).filter((n) => n.name === 'take').map((n) => n.filePath).sort();
104};
105
106describe('Rust `use` scopes at a call', () => {
107 it('lets a block\'s own use win where it is, and no further', () => {

Callers 2

callerFunction · 0.85

Calls 4

mapMethod · 0.80
getNodeMethod · 0.80
getNodesInFileMethod · 0.65
getOutgoingEdgesFromMethod · 0.45

Tested by

no test coverage detected