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

Method visit

src/mcp/tools.ts:3640–3659  ·  view source on GitHub ↗
(id: string, depth: number)

Source from the content-addressed store, hash-verified

3638 let opaque = false;
3639 const seen = new Set<string>();
3640 const visit = (id: string, depth: number): boolean => {
3641 if (seen.has(id)) return false;
3642 seen.add(id);
3643 let node: Node | null = null;
3644 let edges: ReturnType<typeof cg.getOutgoingEdges> = [];
3645 try { node = cg.getNode(id); edges = cg.getOutgoingEdges(id); } catch { return false; }
3646 let own = 0;
3647 for (const e of edges) {
3648 if (e.kind !== 'contains') continue;
3649 let child: Node | null = null;
3650 try { child = cg.getNode(e.target); } catch { child = null; }
3651 if (!child) continue;
3652 if (child.name === name) return true;
3653 if (counts(child.kind)) own++;
3654 }
3655 if (own > 0) sawMembers = true;
3656 else if (node && (node.kind === 'interface' || node.kind === 'protocol' || node.kind === 'trait')) opaque = true;
3657 if (depth >= 3) return false;
3658 return edges.some((e) => (e.kind === 'extends' || e.kind === 'implements') && visit(e.target, depth + 1));
3659 };
3660 let root: Node | null = null;
3661 try { root = cg.getNode(typeId); } catch { root = null; }
3662 let namesakes: Node[] = [];

Callers

nothing calls this directly

Calls 5

hasMethod · 0.80
addMethod · 0.80
getNodeMethod · 0.80
visitFunction · 0.50
getOutgoingEdgesMethod · 0.45

Tested by

no test coverage detected