* What this symbol sits on: one row per module, with how many call sites reach * into it. * * A module reached from six places and a module reached once are two different * relationships, and a flat list of twenty call sites hides which is which. * That is the whole difference between this and
(ir: SemanticIR)
| 1036 | * facts, grouped by the thing the architect is asking about. |
| 1037 | */ |
| 1038 | function groundRows(ir: SemanticIR): TwinRow[] { |
| 1039 | const byModule = new Map<string, { calls: CallSite[]; firstIndex: number }>(); |
| 1040 | ir.steps.value.forEach((call, index) => { |
| 1041 | const key = call.targetFile; |
| 1042 | if (key === undefined || key.length === 0) { |
| 1043 | return; |
| 1044 | } |
| 1045 | const entry = byModule.get(key); |
| 1046 | if (entry === undefined) { |
| 1047 | byModule.set(key, { calls: [call], firstIndex: index }); |
| 1048 | } else { |
| 1049 | entry.calls.push(call); |
| 1050 | } |
| 1051 | }); |
| 1052 | return [...byModule.entries()].map(([uri, entry]) => { |
| 1053 | const certainty = certaintyOf( |
| 1054 | entry.calls.find((call) => call.confidence !== undefined)?.confidence, |
| 1055 | ir.steps.state |
| 1056 | ); |
| 1057 | const strategy = entry.calls.find((call) => call.strategy !== undefined)?.strategy; |
| 1058 | return { |
| 1059 | id: `ground-${entry.firstIndex}`, |
| 1060 | label: moduleLabel(uri), |
| 1061 | detail: entry.calls.map((call) => call.targetName).join(', '), |
| 1062 | target: refAt(uri, entry.calls[0].targetLine ?? entry.calls[0].line, moduleLabel(uri)), |
| 1063 | factPath: `steps[${entry.firstIndex}]`, |
| 1064 | confidenceLabel: certainty.label, |
| 1065 | confidenceNote: certainty.note, |
| 1066 | extras: [ |
| 1067 | groundReach(entry.calls.length), |
| 1068 | ...(strategy === undefined ? [] : [strategyLabel(strategy)]) |
| 1069 | ] |
| 1070 | }; |
| 1071 | }); |
| 1072 | } |
| 1073 | |
| 1074 | /** What holds this symbol up: its callers, plus what the outside world can reach. */ |
| 1075 | function carrierRows(ir: SemanticIR, sections: readonly TwinSection[]): TwinRow[] { |
no test coverage detected