All files / utils/types IAutoConstFacts.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 36 37 38 39 40 41                                                                                 
/**
 * The facts ADR-013 auto-const (#268) is decided from.
 *
 * Auto-const is asked about a parameter in two different representations --
 * a parse-tree parameter while generating a body, and a resolved symbol while
 * generating a header -- and ADR-013 requires the two to reach the same
 * answer ("the .h matches the .c"). Naming the facts here is what lets one
 * rule serve both: each caller looks the facts up in its own vocabulary, and
 * neither one owns the decision.
 */
interface IAutoConstFacts {
  /** The C-Next type name, e.g. `u32`, `f32`, `ISR`, `Point`, `string<32>`. */
  readonly baseType: string;
 
  /** Whether the function body assigns through this parameter. */
  readonly isModified: boolean;
 
  /** Whether the source wrote `const` on the parameter itself. */
  readonly isExplicitlyConst: boolean;
 
  /**
   * Whether the enclosing function is assigned to a C callback typedef.
   * The typedef dictates the parameter shape, so C-Next may not narrow it.
   */
  readonly isCallbackCompatible: boolean;
 
  /** Whether the parameter is an array. */
  readonly isArray: boolean;
 
  /** Whether `baseType` names an enum, which ADR-013 passes by value. */
  readonly isKnownEnum: boolean;
 
  /**
   * Whether the parameter is a #995 opaque handle -- an incomplete type the
   * producing C API hands back and expects mutable.
   */
  readonly isOpaqueHandle: boolean;
}
 
export default IAutoConstFacts;