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

Function guards

src/ui-server/api/when.ts:166–176  ·  view source on GitHub ↗
(
    caller: { filePath: string; language: Language },
    site: { line?: number; column?: number }
  )

Source from the content-addressed store, hash-verified

164 // Named rather than a method, because `createWhenReader` hands `when` out
165 // detached: it must not depend on `this`.
166 const guards = async (
167 caller: { filePath: string; language: Language },
168 site: { line?: number; column?: number }
169 ): Promise<BranchGuard[]> => {
170 if (!site.line || sites >= maxSites || !supportsBranchGuards(caller.language)) return [];
171 const file = resolve(caller);
172 if (!file) return [];
173 sites++;
174 const key = { line: site.line, column: typeof site.column === 'number' ? site.column : null };
175 return (await guardsForFile(file.abs, file.language, [key])).get(siteKey(key)) ?? [];
176 };
177 return {
178 guards,
179 async when(caller, site) {

Callers 1

whenFunction · 0.85

Calls 5

supportsBranchGuardsFunction · 0.90
guardsForFileFunction · 0.90
siteKeyFunction · 0.90
resolveFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected