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

Function classByQualifiedName

src/resolution/pascal-scope.ts:1876–1891  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

1874 * or parameters, else one the file sees.
1875 */
1876function 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

Callers 3

matchPascalParenlessRefFunction · 0.85
matchPascalInheritedCallFunction · 0.85
classOfCallFunction · 0.85

Calls 9

memosFunction · 0.85
ownUnitFilesFunction · 0.85
declarationOfFunction · 0.85
outlineOfFunction · 0.85
hasMethod · 0.80
classNamedFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected