All files / transpiler/output/codegen/types IVariableFormatInput.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                                                                                                       
/**
 * IVariableFormatInput - Normalized input for variable declaration formatting.
 *
 * Phase 2 of unified code generation: Provides a single source of truth for
 * variable declaration string generation, eliminating sync issues between
 * .c/.cpp and .h/.hpp files.
 *
 * Unlike parameters (which have complex pass-by-value/reference semantics),
 * variable declarations focus on:
 * - Modifier ordering (extern, const, volatile)
 * - Type formatting (including string<N> → char[N+1])
 * - Array dimension placement
 */
 
/**
 * Modifier flags for variable declarations.
 * These are resolved before formatting - no CodeGenState access needed.
 */
interface IVariableModifiers {
  /** Explicit const modifier */
  isConst: boolean;
  /** atomic modifier (maps to volatile in C) */
  isAtomic: boolean;
  /** Explicit volatile modifier */
  isVolatile: boolean;
  /** extern linkage (for headers or top-level const in C++) */
  isExtern: boolean;
}
 
/**
 * Normalized input for variable declaration formatting.
 * All fields are pre-computed - the formatter is stateless.
 */
interface IVariableFormatInput {
  /** Variable name */
  name: string;
 
  /** Original C-Next type (e.g., 'u32', 'string<32>') */
  cnextType: string;
 
  /** Mapped C type (e.g., 'uint32_t', 'char[33]') */
  mappedType: string;
 
  /** Pre-resolved modifier flags */
  modifiers: IVariableModifiers;
 
  /** Array dimensions as strings (e.g., ['10', '20']) */
  arrayDimensions?: readonly string[];
}
 
export default IVariableFormatInput;