( container: Node, ref: UnresolvedRef, localName: string, context: ResolutionContext )
| 2250 | } |
| 2251 | |
| 2252 | function resolveStaticMember( |
| 2253 | container: Node, |
| 2254 | ref: UnresolvedRef, |
| 2255 | localName: string, |
| 2256 | context: ResolutionContext |
| 2257 | ): Node | undefined { |
| 2258 | if (!STATIC_MEMBER_CONTAINERS.has(container.kind)) return undefined; |
| 2259 | // First segment after the receiver: `Foo.bar.baz` → `bar`. |
| 2260 | const member = ref.referenceName.slice(localName.length + 1).split('.')[0]; |
| 2261 | if (!member) return undefined; |
| 2262 | |
| 2263 | const candidates = context |
| 2264 | .getNodesByQualifiedName(`${container.qualifiedName}::${member}`) |
| 2265 | .filter((n) => n.filePath === container.filePath); |
| 2266 | if (candidates.length === 0) return undefined; |
| 2267 | |
| 2268 | // When the reference is a call, prefer a callable member if several nodes |
| 2269 | // share the qualifiedName (e.g. a static property and a method). |
| 2270 | if (ref.referenceKind === 'calls') { |
| 2271 | const callable = candidates.find((n) => n.kind === 'method' || n.kind === 'function'); |
| 2272 | if (callable) return callable; |
| 2273 | } |
| 2274 | return candidates[0]; |
| 2275 | } |
no test coverage detected