All files / TRANSPILE/3-Render/codegen/types IPlannedFunctionParameter.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 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                           
import type IPlannedType from "./IPlannedType";
 
/**
 * A function parameter as the function CONTEXT needs it -- the registry of
 * what each parameter is, which every later access consults.
 *
 * #1445: `FunctionContextManager` read this off a `ParameterContext`. It asks
 * the same node three questions -- the name, whether it is an array, and what
 * its type is -- and everything it decides afterwards comes from
 * `CodeGenState` and the callback typedef.
 *
 * ## Why this is not `IPlannedParameter`
 *
 * That record serves ADR-006's SIGNATURE adapter and this one serves the
 * parameter registry, and they genuinely disagree about two things:
 *
 * - **`isArray`.** Here it means either spelling. The signature adapter means
 *   only `u8[4] p`, because that is the only spelling it ever sees: a C-style
 *   `u8 p[4]` is E0874 in pass 2.1, with one exemption -- `main(string args[])`
 *   -- and the main-with-args path emits `int argc, char *argv[]` outright
 *   without consulting the adapter. So the two notions differ on exactly one
 *   parameter in the language, and both are right for their reader.
 * - **The dimensions.** The adapter wants C text (`"SIZE"` folded to `"6"`);
 *   this wants numbers for ADR-036 bounds checking, with a slot kept for a
 *   dimension that did not fold so dimension i still matches subscript i.
 *
 * Two records deriving different facts is not the duplication CLAUDE.md
 * forbids -- deriving the SAME fact twice would be, and the .c/.h version of
 * that is #1639.
 */
interface IPlannedFunctionParameter {
  readonly name: string;
 
  /** An explicit `const` modifier in the source. */
  readonly isConst: boolean;
 
  /** Either array spelling -- see the note above on why that differs. */
  readonly isArray: boolean;
 
  /**
   * The dimensions, folded to values, with `UNRESOLVED_DIMENSION` for a slot
   * that did not fold. Empty when the parameter is not an array.
   */
  readonly arrayDimensions: readonly number[];
 
  /** A bounded string's capacity, at the top level or as an array's element. */
  readonly stringCapacity: number | undefined;
 
  /** The type's alternatives, classified once by the one ladder. */
  readonly type: IPlannedType;
}
 
export default IPlannedFunctionParameter;