* Find all callers of a function/method * * @param nodeId - ID of the function/method node * @param maxDepth - Maximum depth to traverse (default: 1) * @returns Array of nodes that call this function
(nodeId: string, maxDepth: number = 1)
| 259 | * @returns Array of nodes that call this function |
| 260 | */ |
| 261 | getCallers(nodeId: string, maxDepth: number = 1): Array<{ node: Node; edge: Edge }> { |
| 262 | const result: Array<{ node: Node; edge: Edge }> = []; |
| 263 | const visited = new Set<string>(); |
| 264 | |
| 265 | this.getCallersRecursive(nodeId, maxDepth, 0, result, visited); |
| 266 | |
| 267 | return result; |
| 268 | } |
| 269 | |
| 270 | private getCallersRecursive( |
| 271 | nodeId: string, |
no test coverage detected