* 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)
| 924 | * it is nested in can call. |
| 925 | */ |
| 926 | function 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. */ |
| 941 | function routineNode(id: string, context: ResolutionContext): Node | null { |
no test coverage detected