(ir: SemanticIR)
| 562 | } |
| 563 | |
| 564 | function errorsSection(ir: SemanticIR): TwinSection { |
| 565 | const aligned = ir.throws.value.length === ir.throws.evidence.length; |
| 566 | const rows: TwinRow[] = ir.throws.value.map((entry, index) => { |
| 567 | // The 0.9.0 engine records no raise-site line, so the fact's own line is |
| 568 | // a declaration-level fallback. The citation, however, points at the |
| 569 | // error type's declaration, which is the one place worth opening. |
| 570 | const citation = aligned ? ir.throws.evidence[index] : undefined; |
| 571 | const target = citation |
| 572 | ? evidenceTarget(citation, entry.type) |
| 573 | : (entry.file ? refAt(entry.file, entry.line, entry.type) : undefined); |
| 574 | return { |
| 575 | id: `throw-${index}`, |
| 576 | label: entry.type, |
| 577 | detail: locationLabel(target?.uri ?? entry.file, citation?.range?.startLine ?? entry.line), |
| 578 | target, |
| 579 | factPath: `throws[${index}]` |
| 580 | }; |
| 581 | }); |
| 582 | return { |
| 583 | name: 'errors', |
| 584 | title: SECTION_ERRORS, |
| 585 | subject: SUBJECT_ERRORS, |
| 586 | block: 'errors', |
| 587 | state: ir.throws.state, |
| 588 | factPath: 'throws', |
| 589 | rows, |
| 590 | // Only said when there is something to say it about. "Where these are |
| 591 | // handled is not visible" over an empty list would be a sentence about |
| 592 | // nothing, and the empty sentence already covers that case. |
| 593 | note: rows.length > 0 ? ERRORS_HANDLING_NOT_VISIBLE : undefined, |
| 594 | emptyText: ERRORS_EMPTY, |
| 595 | populated: rows.length > 0 |
| 596 | }; |
| 597 | } |
| 598 | |
| 599 | function testsSection(ir: SemanticIR): TwinSection { |
| 600 | const rows: TwinRow[] = ir.tests.value.map((test, index) => ({ |
no test coverage detected