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

Function isNestedRoutine

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

* Whether a node is a routine nested in another (see nestedRoutineInScope): * a Pascal function qualified under a routine, which no code outside the one * it is nested in can call.

(node: Node, context: ResolutionContext)

Source from the content-addressed store, hash-verified

924 * it is nested in can call.
925 */
926function isNestedRoutine(node: Node, context: ResolutionContext): boolean {
927 if (node.kind !== 'function' || node.language !== 'pascal') return false;
928 const cut = node.qualifiedName.lastIndexOf('::');
929 if (cut < 0) return false;
930 const outer = node.qualifiedName.slice(0, cut);
931 const memo = memos(context).routineQns;
932 let routine = memo.get(outer);
933 if (routine === undefined) {
934 routine = context.getNodesByQualifiedName(outer).some((n) => n.language === 'pascal' && isRoutine(n));
935 memo.set(outer, routine);
936 }
937 return routine;
938}
939
940/** The routine a reference comes from, or null when it comes from a file or anything else. */
941function routineNode(id: string, context: ResolutionContext): Node | null {

Callers 4

gatePascalCallFunction · 0.85
nestedRoutineInScopeFunction · 0.85
matchPascalNestedCallFunction · 0.85
nestedRoutineSpansFunction · 0.85

Calls 5

memosFunction · 0.85
isRoutineFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected