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

Function isNestedRoutine

src/resolution/pascal-scope.ts:417–429  ·  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

415 * it is nested in can call.
416 */
417function isNestedRoutine(node: Node, context: ResolutionContext): boolean {
418 if (node.kind !== 'function' || node.language !== 'pascal') return false;
419 const cut = node.qualifiedName.lastIndexOf('::');
420 if (cut < 0) return false;
421 const outer = node.qualifiedName.slice(0, cut);
422 const memo = memos(context).routineQns;
423 let routine = memo.get(outer);
424 if (routine === undefined) {
425 routine = context.getNodesByQualifiedName(outer).some((n) => n.language === 'pascal' && isRoutine(n));
426 memo.set(outer, routine);
427 }
428 return routine;
429}
430
431/** The routine a reference comes from, or null when it comes from a file or anything else. */
432function routineNode(id: string, context: ResolutionContext): Node | null {

Callers 3

gatePascalCallFunction · 0.85
nestedRoutineInScopeFunction · 0.85
matchPascalNestedCallFunction · 0.85

Calls 5

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

Tested by

no test coverage detected