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

Method visit

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

Source from the content-addressed store, hash-verified

4231 let opaque = false;
4232 const seen = new Set<string>();
4233 const visit = (id: string, depth: number): boolean => {
4234 if (seen.has(id)) return false;
4235 seen.add(id);
4236 let node: Node | null = null;
4237 let edges: ReturnType<typeof cg.getOutgoingEdges> = [];
4238 try { node = cg.getNode(id); edges = cg.getOutgoingEdges(id); } catch { return false; }
4239 let own = 0;
4240 for (const e of edges) {
4241 if (e.kind !== 'contains') continue;
4242 let child: Node | null = null;
4243 try { child = cg.getNode(e.target); } catch { child = null; }
4244 if (!child) continue;
4245 if (child.name === name) return true;
4246 if (counts(child.kind)) own++;
4247 }
4248 if (own > 0) sawMembers = true;
4249 else if (node && (node.kind === 'interface' || node.kind === 'protocol' || node.kind === 'trait')) opaque = true;
4250 if (depth >= 3) return false;
4251 return edges.some((e) => (e.kind === 'extends' || e.kind === 'implements') && visit(e.target, depth + 1));
4252 };
4253 let root: Node | null = null;
4254 try { root = cg.getNode(typeId); } catch { root = null; }
4255 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