All files / utils/constants TypeMappings.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

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                                  34x                                    
/**
 * C-Next to C Type Mappings
 *
 * Single source of truth for type mappings used across:
 * - CodeGenerator (src/codegen/types/TYPE_MAP.ts)
 * - TypeUtils (src/symbol_resolution/cnext/utils/TypeUtils.ts)
 * - Header Generator (src/codegen/headerGenerators/mapType.ts)
 */
 
/**
 * Maps C-Next primitive types to their C equivalents.
 *
 * Used by:
 * - Code generation for variable/parameter declarations
 * - Header generation for extern declarations
 * - Symbol resolution for type conversion
 */
const CNEXT_TO_C_TYPE_MAP: Record<string, string> = {
  u8: "uint8_t",
  u16: "uint16_t",
  u32: "uint32_t",
  u64: "uint64_t",
  i8: "int8_t",
  i16: "int16_t",
  i32: "int32_t",
  i64: "int64_t",
  f32: "float",
  f64: "double",
  bool: "bool",
  void: "void",
  ISR: "ISR", // ADR-040: Interrupt Service Routine function pointer
  cstring: "char*", // ADR-046: C string pointer type (nullable)
};
 
export default CNEXT_TO_C_TYPE_MAP;