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

Function contextOver

__tests__/cpp-macro-include-walk.test.ts:42–52  ·  view source on GitHub ↗

A context over in-memory files where every name is both a macro and a function.

(files: Record<string, string>)

Source from the content-addressed store, hash-verified

40
41/** A context over in-memory files where every name is both a macro and a function. */
42function contextOver(files: Record<string, string>): ResolutionContext {
43 return {
44 getNodesByName: (name: string) => [
45 { kind: 'constant', signature: `#define ${name}(v) (v)` },
46 { kind: 'function' },
47 ],
48 readFile: (f: string) => files[f] ?? null,
49 fileExists: (f: string) => f in files,
50 getAllFiles: () => Object.keys(files),
51 } as unknown as ResolutionContext;
52}
53
54const call = (name: string, line: number): UnresolvedRef =>
55 ({ language: 'cpp', referenceKind: 'calls', referenceName: name, filePath: 'unit.cpp', line }) as UnresolvedRef;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected