( container: Node, ref: UnresolvedRef, localName: string, context: ResolutionContext )
| 2744 | } |
| 2745 | |
| 2746 | function resolveStaticMember( |
| 2747 | container: Node, |
| 2748 | ref: UnresolvedRef, |
| 2749 | localName: string, |
| 2750 | context: ResolutionContext |
| 2751 | ): Node | undefined { |
| 2752 | if (!STATIC_MEMBER_CONTAINERS.has(container.kind)) return undefined; |
| 2753 | // First segment after the receiver: `Foo.bar.baz` → `bar`. |
| 2754 | const member = ref.referenceName.slice(localName.length + 1).split('.')[0]; |
| 2755 | if (!member) return undefined; |
| 2756 | |
| 2757 | const candidates = context |
| 2758 | .getNodesByQualifiedName(`${container.qualifiedName}::${member}`) |
| 2759 | .filter((n) => n.filePath === container.filePath); |
| 2760 | if (candidates.length === 0) return undefined; |
| 2761 | |
| 2762 | // When the reference is a call, prefer a callable member if several nodes |
| 2763 | // share the qualifiedName (e.g. a static property and a method). |
| 2764 | if (ref.referenceKind === 'calls') { |
| 2765 | const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function'); |
| 2766 | if (callable) return callable; |
| 2767 | } |
| 2768 | return candidates[0]; |
| 2769 | } |
| 2770 | |
| 2771 | /** |
| 2772 | * Rust `use` declarations, flattened to `localName → full path`. |
no test coverage detected