* A unit's top-level declaration of a name (its enum values included), as * code in `fromFile` sees it: another unit's member that its parse lost (see * unitRoutineColumn) is not one, while in its own unit it is most likely the * member the code calls.
(filePath: string, lower: string, context: ResolutionContext, fromFile = filePath)
| 2190 | * member the code calls. |
| 2191 | */ |
| 2192 | function unitDeclaration(filePath: string, lower: string, context: ResolutionContext, fromFile = filePath): Node | undefined { |
| 2193 | // Another unit sees only the routines a unit's interface section declares. |
| 2194 | const otherUnit = fromFile !== filePath && !ownUnitFiles(fromFile, context).includes(filePath); |
| 2195 | const decls = pascalNamed(lower, context).filter((n) => |
| 2196 | n.filePath === filePath && UNIT_KINDS.has(n.kind) && (n.kind === 'enum_member' || !n.qualifiedName.includes('::')) && |
| 2197 | !(fromFile !== filePath && n.kind === 'function' && n.startColumn > unitRoutineColumn(filePath, context)) && |
| 2198 | !(otherUnit && n.kind === 'function' && !exportedRoutine(n, context))); |
| 2199 | // A routine declared in the interface and defined in the implementation is |
| 2200 | // one name; of overloads, one called without arguments first. |
| 2201 | return decls.find((n) => !isRoutine(n)) ?? decls.find((n) => !needsArguments(n)) ?? decls[0]; |
| 2202 | } |
| 2203 | |
| 2204 | /** |
| 2205 | * Whether other units see a unit's routine: one its unit's interface section |
no test coverage detected