Facts whose impact is useful before any level-specific shape begins.
(ir: SemanticIR, facets: ReadonlySet<Facet>)
| 766 | |
| 767 | /** Facts whose impact is useful before any level-specific shape begins. */ |
| 768 | function contextLines(ir: SemanticIR, facets: ReadonlySet<Facet>): string[] { |
| 769 | const lines: string[] = []; |
| 770 | if (facets.has(Facet.Data)) { |
| 771 | const names = sharedNames(ir); |
| 772 | if (names.length > 0) { |
| 773 | lines.push(`${ir.symbol.name} leans on shared names declared outside its own lines: ${joinNames(names)}.`); |
| 774 | } |
| 775 | } |
| 776 | if (facets.has(Facet.Calls) && ir.calledBy.value.length > 0) { |
| 777 | const callers = ir.calledBy.value.map((caller) => callerLabel(caller.name)).filter((name) => name.length > 0); |
| 778 | lines.push(`${callers.length} callers reach ${ir.symbol.name}: ${joinNames(callers)}.`); |
| 779 | } |
| 780 | return lines; |
| 781 | } |
| 782 | |
| 783 | /** Module callers are shown as plain labels, never as path-shaped jargon. */ |
| 784 | function callerLabel(name: string): string { |
no test coverage detected