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

Function visible

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

Source from the content-addressed store, hash-verified

1026function classThroughAliases(simple: string, fromFile: string, context: ResolutionContext, seen: Set<string>): Node | null {
1027 const named = pascalNamed(simple, context);
1028 const visible = (kinds: ReadonlySet<string>): Node[] => {
1029 // In the unit's own files, then in the unit used last, which declares the
1030 // name Delphi sees; else in the one unit that does.
1031 const candidates = named.filter((n) => kinds.has(n.kind));
1032 for (const file of ownUnitFiles(fromFile, context)) {
1033 const own = candidates.filter((n) => n.filePath === file);
1034 if (own.length > 0) return own;
1035 }
1036 const used = usedUnitFiles(fromFile, context);
1037 for (let i = used.length - 1; i >= 0; i--) {
1038 const there = candidates.filter((n) => n.filePath === used[i]);
1039 if (there.length > 0) return there;
1040 }
1041 return candidates.length > 0 && candidates.every((n) => n.filePath === candidates[0]!.filePath) ? candidates : [];
1042 };
1043 const cls = declarationOf(visible(CLASS_KINDS));
1044 if (cls) return cls;
1045 // 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