The project's files by lowercased name, and its Pascal sources.
(context: ResolutionContext)
| 951 | |
| 952 | /** The project's files by lowercased name, and its Pascal sources. */ |
| 953 | function projectFiles(context: ResolutionContext): { byName: Map<string, string[]>; pascal: string[] } { |
| 954 | const m = memos(context); |
| 955 | if (!m.projectFiles) { |
| 956 | const byName = new Map<string, string[]>(); |
| 957 | const pascal: string[] = []; |
| 958 | for (const file of context.getAllFiles()) { |
| 959 | const base = file.slice(file.lastIndexOf('/') + 1).toLowerCase(); |
| 960 | const same = byName.get(base); |
| 961 | if (same) same.push(file); |
| 962 | else byName.set(base, [file]); |
| 963 | if (PASCAL_SOURCE.test(file)) pascal.push(file); |
| 964 | } |
| 965 | m.projectFiles = { byName, pascal }; |
| 966 | } |
| 967 | return m.projectFiles; |
| 968 | } |
| 969 | |
| 970 | /** The file of the unit a name names, nearest to `fromFile` when several units share it. */ |
| 971 | function unitFileNamed(lower: string, fromFile: string, context: ResolutionContext): string | null { |
no test coverage detected