The project's files by lowercased name, and its Pascal sources.
(context: ResolutionContext)
| 2487 | |
| 2488 | /** The project's files by lowercased name, and its Pascal sources. */ |
| 2489 | function projectFiles(context: ResolutionContext): { byName: Map<string, string[]>; pascal: string[] } { |
| 2490 | const m = memos(context); |
| 2491 | if (!m.projectFiles) { |
| 2492 | const byName = new Map<string, string[]>(); |
| 2493 | const pascal: string[] = []; |
| 2494 | for (const file of context.getAllFiles()) { |
| 2495 | const base = file.slice(file.lastIndexOf('/') + 1).toLowerCase(); |
| 2496 | const same = byName.get(base); |
| 2497 | if (same) same.push(file); |
| 2498 | else byName.set(base, [file]); |
| 2499 | if (PASCAL_SOURCE.test(file)) pascal.push(file); |
| 2500 | } |
| 2501 | m.projectFiles = { byName, pascal }; |
| 2502 | } |
| 2503 | return m.projectFiles; |
| 2504 | } |
| 2505 | |
| 2506 | /** The file of the unit a name names, nearest to `fromFile` when several units share it. */ |
| 2507 | function unitFileNamed(lower: string, fromFile: string, context: ResolutionContext): string | null { |
no test coverage detected