All files / TRANSPILE/3-Render/codegen/types ICodeGeneratorOptions.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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71                                                                                                                                             
import ICodeGenSymbols from "../../../../types/ICodeGenSymbols";
import type ITargetDescription from "../../../../types/ITargetDescription";
import type EFileType from "../../../../PARSE/1-Discover/types/EFileType";
 
/**
 * Options for the code generator
 */
interface ICodeGeneratorOptions {
  /** ADR-044: When true, generate panic helpers instead of clamp helpers */
  debugMode?: boolean;
  /**
   * ADR-055: Pre-collected symbol info from CNextResolver + TSymbolInfoAdapter.
   * When provided, CodeGenerator uses this instead of creating SymbolCollector.
   */
  symbolInfo?: ICodeGenSymbols;
  /**
   * ADR-049: the target this file is generated for, decided by the
   * orchestrator before codegen. Required, like `symbolInfo`: codegen never
   * resolves a target itself.
   */
  targetDescription?: ITargetDescription;
  /** ADR-010: Source file path for validating includes */
  sourcePath?: string;
  /**
   * Issue #250: When true, generate C++ compatible code.
   * Uses temporary variables instead of compound literals for rvalue pointer params.
   */
  cppMode?: boolean;
  /**
   * Issue #339: Relative path from source root to source file for self-include.
   * When set, self-includes will use this relative path instead of just the basename.
   * Example: "Display/Utils.cnx" -> #include "Display/Utils.h"
   */
  sourceRelativePath?: string;
  /**
   * Issue #1467: author spelling -> resolved header path, decided once by
   * PathResolver during discovery.
   *
   * Replaces the `includeDirs`/`inputs` pair added for #349. Those declared a
   * path resolution inside codegen that the only production caller never
   * supplied, so the resolution was dead for the whole pipeline while the
   * options advertised it.
   */
  cnxIncludeRewrites?: ReadonlyMap<string, string>;
  /**
   * #1444, owner ruling 1: the kind of file each `#include` directive's
   * spelling names, keyed by `IncludeDirectiveText.join`, as 1.1 Discover
   * classified it. Render rewrites a directive only when this says C-Next,
   * and classifies nothing itself.
   */
  includeKinds?: ReadonlyMap<string, EFileType>;
  /**
   * Issue #1515: whether this file has a public C interface, so the generated
   * `.c` must include its own header.
   *
   * Decided by `PublicInterface`, which owns the rule, and passed IN rather
   * than looked up. It used to ride on `ICodeGenSymbols`, computed by
   * `TSymbolInfoAdapter` in 1.3 Declare -- making the earliest pass in the
   * pipeline the author of an emission decision, and a `PARSE -> TRANSPILE`
   * edge the moment `PublicInterface` was placed in 2.2 Plan.
   *
   * Asking the run-wide symbol table here instead was tried and is worse: it
   * makes `generate()` depend on global state for a fact about the file it was
   * handed, so a caller that supplies `symbolInfo` and a `sourcePath` no longer
   * gets a self-contained answer. The caller knows; the caller says.
   */
  hasPublicInterface?: boolean;
}
 
export default ICodeGeneratorOptions;