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