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

Method getUnresolvedNamesAmong

src/db/queries.ts:3002–3032  ·  view source on GitHub ↗

* Which of `names` the index holds an UNRESOLVED reference to. * * The point is honesty about our own blind spots. A `failed` row in * `unresolved_refs` records that some file referenced a name and the resolver * could not decide what it meant — so a symbol with that name cannot be *

(names: Iterable<string>)

Source from the content-addressed store, hash-verified

3000 * (and the module-member index), not a scan of the table.
3001 */
3002 getUnresolvedNamesAmong(names: Iterable<string>): Set<string> {
3003 const unique = [...new Set(names)].filter((name) => name.length > 0);
3004 const found = new Set<string>();
3005 if (unique.length === 0) return found;
3006 // Before schema v8 a reference had no tail and was never parked, and the
3007 // migration leaves every row pending with an empty tail: only the name
3008 // can match (#2913).
3009 const parked = this.hasSchema('unresolved_refs', 'status');
3010
3011 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
3012 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
3013 const placeholders = chunk.map(() => '?').join(',');
3014 const byName = `SELECT DISTINCT reference_name AS name FROM unresolved_refs
3015 WHERE reference_name IN (${placeholders})`;
3016 const rows = (parked
3017 ? this.db
3018 .prepare(
3019 `${byName}
3020 UNION
3021 SELECT DISTINCT name_tail AS name FROM unresolved_refs
3022 WHERE name_tail IN (${placeholders})
3023 UNION
3024 SELECT DISTINCT ${MEMBER_TAIL_SQL} AS name FROM unresolved_refs
3025 WHERE ${MODULE_PARKED_SQL} AND ${MEMBER_TAIL_SQL} IN (${placeholders})`
3026 )
3027 .all(...chunk, ...chunk, ...chunk)
3028 : this.db.prepare(byName).all(...chunk)) as Array<{ name: string }>;
3029 for (const row of rows) found.add(row.name);
3030 }
3031 return found;
3032 }
3033
3034 /**
3035 * Which of `nodeIds` extend or implement a type the resolver could not follow.

Callers 1

buildDeadCodeReportFunction · 0.45

Calls 6

hasSchemaMethod · 0.95
mapMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected