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

Function readBack

__tests__/js-resolution-work.test.ts:117–140  ·  view source on GitHub ↗

* Runs `refs` through the check for a call written on `window.App…`, which * looks up the object the receiver it read back names.

(source: string, refs: UnresolvedRef[])

Source from the content-addressed store, hash-verified

115 * looks up the object the receiver it read back names.
116 */
117 function readBack(source: string, refs: UnresolvedRef[]): { holders: string[]; joined: number } {
118 const lines = source.split('\n');
119 const holders: string[] = [];
120 const context: ResolutionContext = {
121 getNodesInFile: () => [],
122 getNodesByName: (name) => {
123 holders.push(name);
124 return [];
125 },
126 getNodesByQualifiedName: () => [],
127 getNodesByKind: () => [],
128 getNodesByLowerName: () => [],
129 fileExists: () => false,
130 readFile: () => source,
131 getFileLines: () => lines,
132 getProjectRoot: () => '',
133 getAllFiles: () => [],
134 getImportMappings: () => [],
135 };
136 const joined = joinedDuring(() => {
137 for (const ref of refs) matchCollapsedObjectCall(ref, context);
138 });
139 return { holders, joined };
140 }
141
142 const call = (name: string, line: number, column: number): UnresolvedRef => ({
143 fromNodeId: 'bundle', referenceName: name, referenceKind: 'calls', line, column,

Callers 1

Calls 2

joinedDuringFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected