* The calls in the order the body reaches them, joined by a word. * * The connective is the whole point of this level and it is also the place * where a builder is most tempted to lie. "First", "then", "after that" are * claims about order, and order is exactly what the index records: the call
(ir: SemanticIR)
| 858 | * dropped one would be a different order from the one the code runs. |
| 859 | */ |
| 860 | function juniorSteps(ir: SemanticIR): TwinStepLine[] { |
| 861 | const calls = ir.steps.value; |
| 862 | return calls.map((call, index) => { |
| 863 | const last = index === calls.length - 1 && calls.length > 1; |
| 864 | const connective = index === 0 |
| 865 | ? STEP_CONNECTIVES[0] |
| 866 | : (last ? STEP_CONNECTIVE_LAST : STEP_CONNECTIVES[1 + ((index - 1) % (STEP_CONNECTIVES.length - 1))]); |
| 867 | const where = locationLabel(call.targetFile, call.targetLine ?? call.line); |
| 868 | return { |
| 869 | id: `s${index}`, |
| 870 | order: index + 1, |
| 871 | text: `${juniorStep(connective, call.targetName)}${where === undefined ? '' : juniorStepAt(where)}.`, |
| 872 | target: stepTarget(call), |
| 873 | factPath: `steps[${index}]` |
| 874 | }; |
| 875 | }); |
| 876 | } |
| 877 | |
| 878 | /** |
| 879 | * The words this level used, explained once each, and only the ones it used. |
no test coverage detected