* 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[])
| 3083 | * `idx_unresolved_name`. |
| 3084 | */ |
| 3085 | getUnresolvedReferenceSourcesNamed(names: Iterable<string>, kinds: readonly string[]): Map<string, Set<string>> { |
| 3086 | const unique = [...new Set(names)].filter((name) => name.length > 0); |
| 3087 | const found = new Map<string, Set<string>>(); |
| 3088 | if (unique.length === 0 || kinds.length === 0) return found; |
| 3089 | const kindPlaceholders = kinds.map(() => '?').join(','); |
| 3090 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3091 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3092 | const placeholders = chunk.map(() => '?').join(','); |
| 3093 | const rows = this.db |
| 3094 | .prepare( |
| 3095 | `SELECT DISTINCT reference_name AS name, from_node_id AS id FROM unresolved_refs |
| 3096 | WHERE reference_name IN (${placeholders}) |
| 3097 | AND reference_kind IN (${kindPlaceholders})` |
| 3098 | ) |
| 3099 | .all(...chunk, ...kinds) as Array<{ name: string; id: string }>; |
| 3100 | for (const row of rows) { |
| 3101 | const ids = found.get(row.name); |
| 3102 | if (ids) ids.add(row.id); |
| 3103 | else found.set(row.name, new Set([row.id])); |
| 3104 | } |
| 3105 | } |
| 3106 | return found; |
| 3107 | } |
| 3108 | |
| 3109 | /** |
| 3110 | * Which of `names` are carried by MORE THAN ONE symbol, at least one of which |