| 66 | * Context for resolution - provides access to the graph |
| 67 | */ |
| 68 | export interface ResolutionContext { |
| 69 | /** Get all nodes in a file */ |
| 70 | getNodesInFile(filePath: string): Node[]; |
| 71 | /** Get all nodes by name */ |
| 72 | getNodesByName(name: string): Node[]; |
| 73 | /** Get all nodes by qualified name */ |
| 74 | getNodesByQualifiedName(qualifiedName: string): Node[]; |
| 75 | /** Get all nodes of a kind */ |
| 76 | getNodesByKind(kind: Node['kind']): Node[]; |
| 77 | /** |
| 78 | * Stream nodes of a kind one at a time instead of materializing (and, unlike |
| 79 | * `getNodesByKind`, without populating the resolver's per-kind array cache). |
| 80 | * For unbounded kinds (`function`, `method`, `struct`) on a symbol-dense |
| 81 | * project the full array is gigabytes — the dynamic-edge synthesizers must |
| 82 | * use this so their memory stays O(1) in node count (#610, #1212). Optional |
| 83 | * so minimal test contexts compile; callers fall back to getNodesByKind. |
| 84 | */ |
| 85 | iterateNodesByKind?(kind: Node['kind']): IterableIterator<Node>; |
| 86 | /** Check if a file exists */ |
| 87 | fileExists(filePath: string): boolean; |
| 88 | /** Read file content */ |
| 89 | readFile(filePath: string): string | null; |
| 90 | /** |
| 91 | * `readFile(filePath)` split into lines, LRU-cached per file. Receiver-type |
| 92 | * inference scans source lines for EVERY `receiver.method()` ref; splitting |
| 93 | * the whole file per ref made that O(refs-in-file × file-size) — ~20% of |
| 94 | * total index CPU on a Java-heavy repo and a driver of the #1122 watchdog |
| 95 | * kill on large ones. Optional so external/test contexts compile without it; |
| 96 | * callers fall back to splitting `readFile` themselves. |
| 97 | */ |
| 98 | getFileLines?(filePath: string): string[] | null; |
| 99 | /** |
| 100 | * The method-definition nodes matching `typeName::methodName` in `language` — |
| 101 | * exactly `resolveMethodOnType`'s kind/language/qualifiedName-suffix filter, |
| 102 | * LRU-cached per (language, type, method). The uncached path re-fetches every |
| 103 | * node sharing the METHOD name (unbounded — tens of thousands on a collision- |
| 104 | * heavy Java repo) and re-scans it per ref, the dominant term in the #1122 |
| 105 | * watchdog kill. Cached entries hold only the small filtered result; per-ref |
| 106 | * disambiguation (import FQN, call-site file) stays in the caller so a cached |
| 107 | * entry is valid from any call site. Optional for external/test contexts. |
| 108 | */ |
| 109 | getMethodMatches?(typeName: string, methodName: string, language: Language): Node[]; |
| 110 | /** Get project root */ |
| 111 | getProjectRoot(): string; |
| 112 | /** Get all files */ |
| 113 | getAllFiles(): string[]; |
| 114 | /** Get nodes by lowercase name (O(1) lookup for fuzzy matching) */ |
| 115 | getNodesByLowerName(lowerName: string): Node[]; |
| 116 | /** |
| 117 | * Direct supertypes of the type named `typeName` (same language): the classes |
| 118 | * it extends and the interfaces / protocols / traits it implements/conforms to, |
| 119 | * by simple name. Backed by the resolved `implements`/`extends` edges, so it is |
| 120 | * EMPTY during the first resolution pass (edges aren't built yet) and populated |
| 121 | * afterward — the conformance pass uses it to resolve a chained method defined |
| 122 | * on a supertype the receiver type conforms to (e.g. a protocol-extension |
| 123 | * method). Optional so external/test contexts compile without it. |
| 124 | */ |
| 125 | getSupertypes?(typeName: string, language: Language): string[]; |
no outgoing calls
no test coverage detected