All files / TRANSPILE/3-Render/codegen/types IPlannedSwitch.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 28 29 30 31 32 33 34 35                                                                     
import type IPlannedSwitchCase from "./IPlannedSwitchCase";
 
/**
 * An ADR-025 switch statement, decided (#1445 box 3).
 *
 * What is left for the generator is the rendering: which label opens the
 * brace, how deep each line indents, and Issue #855's MISRA C:2012 Rule 16.4
 * default. Those are the decisions it should own.
 */
interface IPlannedSwitch {
  /** The rendered subject expression. */
  readonly subject: string;
 
  /**
   * The subject's enum type, when it has one (Issue #471).
   *
   * A bare identifier label is resolved against this enum's members, so a
   * `case IDLE:` inside `switch (state)` emits `EState_IDLE`.
   */
  readonly subjectEnumType: string | undefined;
 
  readonly cases: readonly IPlannedSwitchCase[];
 
  /**
   * The explicit `default`'s body, or null when the source declares none.
   *
   * Null is not "no default": Issue #855 requires one for MISRA C:2012
   * Rule 16.4, and the generator emits an empty one. The distinction the plan
   * carries is whether the SOURCE wrote it.
   */
  readonly renderDefaultBody: (() => readonly string[]) | null;
}
 
export default IPlannedSwitch;