All files / TRANSPILE/3-Render/codegen/types IPlannedForAssignment.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27                                                     
/**
 * An assignment appearing in a `for` header -- in the init or the update.
 *
 * #1445 box 3: ONE shape, where there were two. `generateForAssignment`
 * handled the init form and `generateFor` open-coded the update form inline,
 * with the same three reads and the same `AssignmentOperatorMapper` call
 * duplicated. Two code paths that must produce identical output is what
 * CLAUDE.md calls the project's worst anti-pattern; the grammar's `forUpdate`
 * and `forAssignment` carry the same three children, so they plan to the same
 * record and render through the same function.
 *
 * Both renders are thunks and the target is rendered before the value, which
 * is today's order. The operator is NOT mapped here: `AssignmentOperatorMapper`
 * rejects an operator it does not know, and moving that rejection ahead of the
 * two renders would change which diagnostic a malformed header reports first.
 */
interface IPlannedForAssignment {
  readonly renderTarget: () => string;
  readonly renderValue: () => string;
  /** The C-Next operator as written, e.g. `<-` or `+<-`. */
  readonly operatorText: string;
  /** Source line, for the diagnostic if the operator is not one we map. */
  readonly operatorLine: number | undefined;
}
 
export default IPlannedForAssignment;