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

Function isModule

src/resolution/vbnet-receivers.ts:496–508  ·  view source on GitHub ↗

Whether a VB.NET owner (by qualified name) is a `Module`, whose members are reached without a qualifier.

(ownerQn: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

494
495/** Whether a VB.NET owner (by qualified name) is a `Module`, whose members are reached without a qualifier. */
496function isModule(ownerQn: string, context: ResolutionContext): boolean {
497 let memo = VB_MODULES.get(context);
498 if (!memo) VB_MODULES.set(context, (memo = new Map()));
499 const hit = memo.get(ownerQn);
500 if (hit !== undefined) return hit;
501 // Its own head line or the two after it (attributes may come first); the raw
502 // lines, as the whole file need not be read as code for this.
503 const module = context.getNodesByQualifiedName(ownerQn).some((n) => n.language === 'vbnet' && n.kind === 'class' &&
504 (context.getFileLines?.(n.filePath) ?? context.readFile(n.filePath)?.split(/\r?\n/) ?? []).slice(n.startLine - 1, n.startLine + 2)
505 .some((l) => /^\s*(?:<[^>]*>\s*)*(?:(?:Public|Friend|Private|Partial)\s+)*Module\s/i.test(l)));
506 memo.set(ownerQn, module);
507 return module;
508}
509
510/** The members named `name` of the project's Modules, which code reaches without a qualifier — the caller's project's first. */
511function moduleMembersNamed(name: string, ref: UnresolvedRef, context: ResolutionContext): Node[] {

Callers 4

moduleMembersNamedFunction · 0.85
enclosingTypeFunction · 0.85
headMemberOfFunction · 0.85
isVbMemberInScopeFunction · 0.85

Calls 5

getFileLinesMethod · 0.80
readFileMethod · 0.80
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected