* Every node holding an unresolved reference of `kinds` to each of `names` — * the mirror of getUnresolvedReferenceNamesFrom, keyed by the name: * for `implements`, every class that names an interface outside the index. * Names nothing refers to are absent from the map. Chunked prob
(names: Iterable<string>, kinds: readonly string[])
| 3049 | * `idx_unresolved_name`. |
| 3050 | */ |
| 3051 | getUnresolvedReferenceSourcesNamed(names: Iterable<string>, kinds: readonly string[]): Map<string, Set<string>> { |
| 3052 | const unique = [...new Set(names)].filter((name) => name.length > 0); |
| 3053 | const found = new Map<string, Set<string>>(); |
| 3054 | if (unique.length === 0 || kinds.length === 0) return found; |
| 3055 | const kindPlaceholders = kinds.map(() => '?').join(','); |
| 3056 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3057 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3058 | const placeholders = chunk.map(() => '?').join(','); |
| 3059 | const rows = this.db |
| 3060 | .prepare( |
| 3061 | `SELECT DISTINCT reference_name AS name, from_node_id AS id FROM unresolved_refs |
| 3062 | WHERE reference_name IN (${placeholders}) |
| 3063 | AND reference_kind IN (${kindPlaceholders})` |
| 3064 | ) |
| 3065 | .all(...chunk, ...kinds) as Array<{ name: string; id: string }>; |
| 3066 | for (const row of rows) { |
| 3067 | const ids = found.get(row.name); |
| 3068 | if (ids) ids.add(row.id); |
| 3069 | else found.set(row.name, new Set([row.id])); |
| 3070 | } |
| 3071 | } |
| 3072 | return found; |
| 3073 | } |
| 3074 | |
| 3075 | /** |
| 3076 | * Which of `names` are carried by MORE THAN ONE symbol, at least one of which |