upgradeIR
IR of format from, as format to writes it: each step in turn. Throws if a step is missing.
import type { IR } from "#codebase/tcmts/core/hash"; import { IR_STEPS } from "#codebase/tcmts/core/migrate"; export function upgradeIR(ir: IR, from: number, to: number): IR { let out = ir; for (let v = from; v < to; v++) { const step = IR_STEPS[v]; if (!step) throw new Error(`no way from hash format v${v} to v${v + 1}`); out = step(out); } return out; }