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

Function blockMembers

src/resolution/ambient-modules.ts:688–705  ·  view source on GitHub ↗

The declarations at the block's own level, by name, in position order.

(mod: AmbientModule, context: ResolutionContext)

Source from the content-addressed store, hash-verified

686
687/** The declarations at the block's own level, by name, in position order. */
688function blockMembers(mod: AmbientModule, context: ResolutionContext): Map<string, Node[]> {
689 const memo = memoFor(context);
690 const key = `${mod.file}\0${mod.startLine}\0${mod.startColumn}`;
691 const cached = memo.members.get(key);
692 if (cached) return cached;
693 const members = new Map<string, Node[]>();
694 const nodes = context
695 .getNodesInFile(mod.file)
696 .filter((n) => isBlockLevel(n) && inBlock(n, mod))
697 .sort((a, b) => a.startLine - b.startLine || a.startColumn - b.startColumn);
698 for (const n of nodes) {
699 const list = members.get(n.name);
700 if (list) list.push(n);
701 else members.set(n.name, [n]);
702 }
703 memo.members.set(key, members);
704 return members;
705}
706
707/** A path that is not the program's own: a test, a fixture, an example (see search/query-utils). */
708const isTestCode = (file: string): boolean => isTestFile(file);

Callers 2

findAmbientModuleExportFunction · 0.85

Calls 7

isBlockLevelFunction · 0.85
inBlockFunction · 0.85
pushMethod · 0.80
memoForFunction · 0.70
getMethod · 0.65
getNodesInFileMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected