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

Function guards

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

Source from the content-addressed store, hash-verified

184 // Named rather than a method, because `createWhenReader` hands `when` out
185 // detached: it must not depend on `this`.
186 const guards = async (
187 caller: { filePath: string; language: Language },
188 site: { line?: number; column?: number }
189 ): Promise<BranchGuard[]> => {
190 if (!site.line || sites >= maxSites || !supportsBranchGuards(caller.language)) return [];
191 const file = resolve(caller);
192 if (!file) return [];
193 sites++;
194 const key = { line: site.line, column: typeof site.column === 'number' ? site.column : null };
195 return (await guardsForFile(file.abs, file.language, [key])).get(siteKey(key)) ?? [];
196 };
197 return {
198 guards,
199 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