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

Function resolve

src/resolution/frameworks/codeigniter.ts:299–319  ·  view source on GitHub ↗
(ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

297 },
298
299 resolve(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | null {
300 const name = ref.referenceName;
301 const resolved = (target: Node | null | undefined, confidence: number): ResolvedRef | null =>
302 target ? { original: ref, targetNodeId: target.id, confidence, resolvedBy: 'framework' } : null;
303
304 if (name.startsWith(METHOD_REF)) {
305 const [file, method] = name.slice(METHOD_REF.length).split('|');
306 return resolved(context.getNodesInFile(file!).find((n) => n.kind === 'method' && n.name === method), 0.95);
307 }
308 if (name.startsWith(ROUTE_REF)) {
309 const [root, handler] = name.slice(ROUTE_REF.length).split('|');
310 return resolved(routeHandler(root!, handler!.slice(0, handler!.lastIndexOf(':')), context), 0.9);
311 }
312 const call = PROPERTY_CALL.exec(name);
313 if (call) {
314 if (call[1] === 'load' && call[2] === 'view') return resolved(viewFile(ref, context), 0.9);
315 const cls = propertyClass(call[1]!, ref.filePath, context);
316 return resolved(cls && methodOf(cls, call[2]!, context), 0.9);
317 }
318 return null;
319 },
320
321 extract(filePath: string, content: string): { nodes: Node[]; references: UnresolvedRef[] } {
322 const routes = ROUTES_FILE.test(filePath);

Callers

nothing calls this directly

Calls 7

routeHandlerFunction · 0.85
viewFileFunction · 0.85
propertyClassFunction · 0.85
resolvedFunction · 0.70
methodOfFunction · 0.70
getNodesInFileMethod · 0.65
execMethod · 0.65

Tested by

no test coverage detected