* The member one use links, and how. A call links what it calls: a method, * or a signal held in a field (`count = signal(0)` is a property). A name * read without a call links only a method-kind member — a getter runs when * it is read, so it is called; a function handed over uncalled * (`[disp
( candidates: readonly Node[] | undefined, call: boolean, shape: (n: Node) => MemberShape )
| 606 | * resolve as the event bindings' do: the last declared (an overload's body). |
| 607 | */ |
| 608 | function bindingTarget( |
| 609 | candidates: readonly Node[] | undefined, |
| 610 | call: boolean, |
| 611 | shape: (n: Node) => MemberShape |
| 612 | ): { node: Node; kind: 'calls' | 'references'; fnRef: boolean } | null { |
| 613 | if (!candidates) return null; |
| 614 | const methods = candidates.filter((n) => n.kind === 'method'); |
| 615 | if (call) { |
| 616 | const target = |
| 617 | [...methods].reverse().find((n) => shape(n) === 'function' || shape(n) === 'value') ?? |
| 618 | methods[0] ?? |
| 619 | candidates.find((n) => n.kind === 'property'); |
| 620 | return target ? { node: target, kind: 'calls', fnRef: false } : null; |
| 621 | } |
| 622 | const getter = methods.find((n) => shape(n) === 'get'); |
| 623 | if (getter) return { node: getter, kind: 'calls', fnRef: false }; |
| 624 | const read = [...methods].reverse().find((n) => shape(n) !== 'set'); |
| 625 | return read ? { node: read, kind: 'references', fnRef: shape(read) === 'function' } : null; |
| 626 | } |
| 627 | |
| 628 | // ============================================================================= |
| 629 | // The pass |
no test coverage detected