* The member a name reaches in a class or, failing that, in its ancestors, * nearest first; a parameterless overload before the others. Null when no * class of the hierarchy declares it.
(cls: Node, lower: string, context: ResolutionContext)
| 770 | * class of the hierarchy declares it. |
| 771 | */ |
| 772 | function memberInHierarchy(cls: Node, lower: string, context: ResolutionContext): Node | null { |
| 773 | const memo = memos(context).hierarchy; |
| 774 | const key = `${cls.id}|${lower}`; |
| 775 | if (memo.has(key)) return memo.get(key)!; |
| 776 | let found: Node | null = null; |
| 777 | const candidates = pascalNamed(lower, context).filter((n) => MEMBER_KINDS.has(n.kind)); |
| 778 | if (candidates.length > 0) { |
| 779 | for (const c of ancestorsOf(cls, context)) { |
| 780 | const owner = c.qualifiedName.toLowerCase(); |
| 781 | const members = candidates.filter((n) => n.filePath === c.filePath && ownerOf(n) === owner); |
| 782 | if (members.length > 0) { |
| 783 | found = members.find((n) => !needsArguments(n)) ?? members[0]!; |
| 784 | break; |
| 785 | } |
| 786 | } |
| 787 | } |
| 788 | memo.set(key, found); |
| 789 | return found; |
| 790 | } |
| 791 | |
| 792 | /** |
| 793 | * A unit's top-level declaration of a name (its enum values included), as |
no test coverage detected