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

Method visit

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

Source from the content-addressed store, hash-verified

4049 let opaque = false;
4050 const seen = new Set<string>();
4051 const visit = (id: string, depth: number): boolean => {
4052 if (seen.has(id)) return false;
4053 seen.add(id);
4054 let node: Node | null = null;
4055 let edges: ReturnType<typeof cg.getOutgoingEdges> = [];
4056 try { node = cg.getNode(id); edges = cg.getOutgoingEdges(id); } catch { return false; }
4057 let own = 0;
4058 for (const e of edges) {
4059 if (e.kind !== 'contains') continue;
4060 let child: Node | null = null;
4061 try { child = cg.getNode(e.target); } catch { child = null; }
4062 if (!child) continue;
4063 if (child.name === name) return true;
4064 if (counts(child.kind)) own++;
4065 }
4066 if (own > 0) sawMembers = true;
4067 else if (node && (node.kind === 'interface' || node.kind === 'protocol' || node.kind === 'trait')) opaque = true;
4068 if (depth >= 3) return false;
4069 return edges.some((e) => (e.kind === 'extends' || e.kind === 'implements') && visit(e.target, depth + 1));
4070 };
4071 let root: Node | null = null;
4072 try { root = cg.getNode(typeId); } catch { root = null; }
4073 let namesakes: Node[] = [];

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected