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

Function resolve

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

nodesNamedLowerFunction · 0.90
routeHandlerFunction · 0.85
viewFileFunction · 0.85
propertyClassFunction · 0.85
resolvedFunction · 0.70
methodOfFunction · 0.70
execMethod · 0.65

Tested by

no test coverage detected