* The class (or record) an implementation header names (`TOuter::TInner`, * generic parameters dropped): the one `filePath` declares, whatever its case * or parameters, else one the file sees.
(qualifiedName: string, filePath: string, context: ResolutionContext)
| 1874 | * or parameters, else one the file sees. |
| 1875 | */ |
| 1876 | function classByQualifiedName(qualifiedName: string, filePath: string, context: ResolutionContext): Node | null { |
| 1877 | const memo = memos(context).classByQn; |
| 1878 | const key = `${filePath}|${qualifiedName}`; |
| 1879 | if (memo.has(key)) return memo.get(key)!; |
| 1880 | const exact = context.getNodesByQualifiedName(qualifiedName).filter((n) => n.language === 'pascal' && CLASS_KINDS.has(n.kind)); |
| 1881 | const lower = qualifiedName.toLowerCase(); |
| 1882 | let cls: Node | null = null; |
| 1883 | for (const file of ownUnitFiles(filePath, context)) { |
| 1884 | cls = declarationOf(exact.filter((n) => n.filePath === file)) ?? |
| 1885 | declarationOf(outlineOf(file, context).classes.filter((n) => n.qualifiedName.replace(/<[^>]*>/g, '').toLowerCase() === lower)); |
| 1886 | if (cls) break; |
| 1887 | } |
| 1888 | cls ??= declarationOf(exact) ?? classNamed(qualifiedName.split('::').pop()!, filePath, context); |
| 1889 | memo.set(key, cls); |
| 1890 | return cls; |
| 1891 | } |
| 1892 | |
| 1893 | /** |
| 1894 | * The class declaration among same-named nodes, not a forward declaration |
no test coverage detected