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

Function resolveInclude

src/resolution/c-fnptr-synthesizer.ts:511–517  ·  view source on GitHub ↗
(includer: string, inc: string)

Source from the content-addressed store, hash-verified

509 // project root. Returns a project-root-relative path that exists on disk
510 // (even if it was never indexed — e.g. redis' generated `commands.def`).
511 const resolveInclude = (includer: string, inc: string): string | null => {
512 const dir = path.posix.dirname(includer.replace(/\\/g, '/'));
513 const cand = path.posix.normalize(path.posix.join(dir, inc));
514 if (ctx.fileExists(cand)) return cand;
515 if (ctx.fileExists(inc)) return inc;
516 return null;
517 };
518
519 // Retained strings are interned through here. Regex captures off a big file
520 // string are V8 sliced strings — retaining one pins the whole parent file

Callers 2

scanIncludesFunction · 0.85
mergeNativeFactsFunction · 0.85

Calls 3

normalizeMethod · 0.80
fileExistsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected