(ref: UnresolvedRef, context: ResolutionContext)
| 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); |
nothing calls this directly
no test coverage detected