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

Method visit

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

Source from the content-addressed store, hash-verified

4067 let opaque = false;
4068 const seen = new Set<string>();
4069 const visit = (id: string, depth: number): boolean => {
4070 if (seen.has(id)) return false;
4071 seen.add(id);
4072 let node: Node | null = null;
4073 let edges: ReturnType<typeof cg.getOutgoingEdges> = [];
4074 try { node = cg.getNode(id); edges = cg.getOutgoingEdges(id); } catch { return false; }
4075 let own = 0;
4076 for (const e of edges) {
4077 if (e.kind !== 'contains') continue;
4078 let child: Node | null = null;
4079 try { child = cg.getNode(e.target); } catch { child = null; }
4080 if (!child) continue;
4081 if (child.name === name) return true;
4082 if (counts(child.kind)) own++;
4083 }
4084 if (own > 0) sawMembers = true;
4085 else if (node && (node.kind === 'interface' || node.kind === 'protocol' || node.kind === 'trait')) opaque = true;
4086 if (depth >= 3) return false;
4087 return edges.some((e) => (e.kind === 'extends' || e.kind === 'implements') && visit(e.target, depth + 1));
4088 };
4089 let root: Node | null = null;
4090 try { root = cg.getNode(typeId); } catch { root = null; }
4091 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