(ref: UnresolvedRef, context: ResolutionContext)
| 956 | * for the other strategies to resolve. |
| 957 | */ |
| 958 | export function matchPascalNestedCall(ref: UnresolvedRef, context: ResolutionContext): ResolvedRef | undefined { |
| 959 | if (ref.language !== 'pascal' || ref.referenceKind !== 'calls' || !isBareCall(ref, context)) return undefined; |
| 960 | const lower = ref.referenceName.toLowerCase(); |
| 961 | let found = nestedRoutineInScope(lower, ref, context); |
| 962 | if (!found) { |
| 963 | const caller = routineNode(ref.fromNodeId, context); |
| 964 | if (!caller || !isNestedRoutine(caller, context)) return undefined; |
| 965 | const decl = declarationInScope(lower, classOfCall(ref, context), ref, context); |
| 966 | if (!decl || !(isRoutine(decl.node) || (DATA_KINDS.has(decl.node.kind) && isProceduralData(decl.node, context)))) return undefined; |
| 967 | found = decl; |
| 968 | } |
| 969 | context.rememberNode?.(found.node); |
| 970 | return { original: ref, targetNodeId: found.node.id, confidence: found.confidence, resolvedBy: found.resolvedBy }; |
| 971 | } |
| 972 | |
| 973 | /** |
| 974 | * A Pascal call another strategy resolved to a routine nested in some other |
no test coverage detected