One family of one callable declaration, searched for any import binding.
(family: ImportUsageFamily, names: readonly string[], ir: SemanticIR)
| 426 | |
| 427 | /** One family of one callable declaration, searched for any import binding. */ |
| 428 | function matchIn(family: ImportUsageFamily, names: readonly string[], ir: SemanticIR): Evidence[] | undefined { |
| 429 | switch (family) { |
| 430 | case 'calls': { |
| 431 | const index = ir.calls.value.findIndex((call) => names.includes(call.targetName)); |
| 432 | return index < 0 ? undefined : citationOf(ir.calls, index); |
| 433 | } |
| 434 | case 'typeRefs': { |
| 435 | const index = (ir.typeRefs?.value ?? []).findIndex((entry) => names.includes(entry.name)); |
| 436 | return index < 0 ? undefined : citationOf(ir.typeRefs, index); |
| 437 | } |
| 438 | case 'throws': { |
| 439 | const index = ir.throws.value.findIndex((entry) => names.includes(entry.type)); |
| 440 | return index < 0 ? undefined : citationOf(ir.throws, index); |
| 441 | } |
| 442 | default: { |
| 443 | const index = ir.reads.value.findIndex((entry) => names.includes(entry.name)); |
| 444 | return index < 0 ? undefined : citationOf(ir.reads, index); |
| 445 | } |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | /** |
| 450 | * True when every family the match would have come from was actually answered, |