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

Method getUnresolvedNamesAmong

src/db/queries.ts:2968–2998  ·  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

2966 * (and the module-member index), not a scan of the table.
2967 */
2968 getUnresolvedNamesAmong(names: Iterable<string>): Set<string> {
2969 const unique = [...new Set(names)].filter((name) => name.length > 0);
2970 const found = new Set<string>();
2971 if (unique.length === 0) return found;
2972 // Before schema v8 a reference had no tail and was never parked, and the
2973 // migration leaves every row pending with an empty tail: only the name
2974 // can match (#2913).
2975 const parked = this.hasSchema('unresolved_refs', 'status');
2976
2977 for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
2978 const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
2979 const placeholders = chunk.map(() => '?').join(',');
2980 const byName = `SELECT DISTINCT reference_name AS name FROM unresolved_refs
2981 WHERE reference_name IN (${placeholders})`;
2982 const rows = (parked
2983 ? this.db
2984 .prepare(
2985 `${byName}
2986 UNION
2987 SELECT DISTINCT name_tail AS name FROM unresolved_refs
2988 WHERE name_tail IN (${placeholders})
2989 UNION
2990 SELECT DISTINCT ${MEMBER_TAIL_SQL} AS name FROM unresolved_refs
2991 WHERE ${MODULE_PARKED_SQL} AND ${MEMBER_TAIL_SQL} IN (${placeholders})`
2992 )
2993 .all(...chunk, ...chunk, ...chunk)
2994 : this.db.prepare(byName).all(...chunk)) as Array<{ name: string }>;
2995 for (const row of rows) found.add(row.name);
2996 }
2997 return found;
2998 }
2999
3000 /**
3001 * 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