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

Function visible

src/resolution/pascal-scope.ts:2564–2578  ·  view source on GitHub ↗
(kinds: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

2562function classThroughAliases(simple: string, fromFile: string, context: ResolutionContext, seen: Set<string>): Node | null {
2563 const named = pascalNamed(simple, context);
2564 const visible = (kinds: ReadonlySet<string>): Node[] => {
2565 // In the unit's own files, then in the unit used last, which declares the
2566 // name Delphi sees; else in the one unit that does.
2567 const candidates = named.filter((n) => kinds.has(n.kind));
2568 for (const file of ownUnitFiles(fromFile, context)) {
2569 const own = candidates.filter((n) => n.filePath === file);
2570 if (own.length > 0) return own;
2571 }
2572 const used = usedUnitFiles(fromFile, context);
2573 for (let i = used.length - 1; i >= 0; i--) {
2574 const there = candidates.filter((n) => n.filePath === used[i]);
2575 if (there.length > 0) return there;
2576 }
2577 return candidates.length > 0 && candidates.every((n) => n.filePath === candidates[0]!.filePath) ? candidates : [];
2578 };
2579 const cls = declarationOf(visible(CLASS_KINDS));
2580 if (cls) return cls;
2581 // A type alias names the class it stands for: `TVTAncestor = TVTAncestorVcl;`,

Callers 5

typeDeclarationsFunction · 0.85
classThroughAliasesFunction · 0.85
seenFromFunction · 0.85
namedClassesFunction · 0.85
declaredTableFunction · 0.85

Calls 3

ownUnitFilesFunction · 0.85
usedUnitFilesFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected