* The class whose method makes a call: the one the nearest method header * above the call names in the source text (`procedure TFoo.Bar;`), which holds * where the tree had errors and gave the code to the file, or to a routine * that swallowed the ones after it; else the reference's method's clas
(ref: UnresolvedRef, context: ResolutionContext)
| 765 | * ancestors include the type it helps (see ancestorsOf). |
| 766 | */ |
| 767 | function classOfCall(ref: UnresolvedRef, context: ResolutionContext): Node | null { |
| 768 | const qn = headerClassAt(ref.filePath!, ref.line, context); |
| 769 | const cls = qn ? classByQualifiedName(qn, ref.filePath!, context) : null; |
| 770 | if (cls) return cls; |
| 771 | const routine = context.getNodeById?.(ref.fromNodeId); |
| 772 | return routine?.kind === 'method' ? classOfRoutine(routine, context) : null; |
| 773 | } |
| 774 | |
| 775 | /** |
| 776 | * Whether what a file's code sees is known: a unit's or a program's file, |
no test coverage detected