A context over in-memory files where every name is both a macro and a function.
(files: Record<string, string>)
| 40 | |
| 41 | /** A context over in-memory files where every name is both a macro and a function. */ |
| 42 | function 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 | |
| 54 | const call = (name: string, line: number): UnresolvedRef => |
| 55 | ({ language: 'cpp', referenceKind: 'calls', referenceName: name, filePath: 'unit.cpp', line }) as UnresolvedRef; |
no outgoing calls
no test coverage detected