All files / PARSE/4-Resolve/types IProgramInputs.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 72 73                                                                                                                                                 
/**
 * Everything 1.4 Resolve needs besides the files themselves.
 *
 * ## Why one object rather than a positional list (#1452)
 *
 * `Program.build` reached eight positional parameters, seven of them with
 * defaults, and TypeScript refused the eighth before anything else did. The
 * defaults are what hid the growth: each new parameter compiled silently, so
 * the signature widened without a single call site objecting. A seven-parameter
 * builder with seven defaults is exactly as coupled as an eight-parameter one
 * -- it just does not say so.
 *
 * The count was not the real cost either. Positionally, adding an input meant
 * editing the signature, every full call, and every test that passed a later
 * argument by position; a named field means editing the interface and the
 * producer. #1452 still has `SymbolTable` and `CodeGenState` to move, and
 * both will want to arrive the same way, so the change point is worth having once.
 *
 * Every field is optional and carries the same empty default the positional
 * form did, so a caller that supplied nothing still supplies nothing.
 */
import type IRunTargetInputs from "./IRunTargetInputs";
import type IForeignSymbols from "./IForeignSymbols";
import type IStructFieldInfo from "../../../types/symbols/IStructFieldInfo";
import type IVisibilityInput from "./IVisibilityInput";
import type SymbolRegistry from "../../3-Declare/SymbolRegistry";
import type SymbolTable from "../../3-Declare/SymbolTable";
 
interface IProgramInputs {
  /** Struct fields the C and C++ headers contributed, by type name. */
  readonly headerStructFields?: ReadonlyMap<
    string,
    ReadonlyMap<string, IStructFieldInfo>
  >;
 
  /** The C and C++ halves of the conflict question, plus the opacity inputs. */
  readonly foreign?: IForeignSymbols;
 
  /**
   * The C and C++ headers' symbols, as the run's table holds them before any
   * C-Next file is published to it (#1825). ADR-006's and ADR-029's
   * derivations look callees and typedefs up in it by name.
   *
   * Absent only where a test builds a program with no headers behind it.
   */
  readonly symbolTable?: SymbolTable;
 
  /** ADR-016 visibility inputs. */
  readonly visibility?: IVisibilityInput;
 
  /**
   * The run's scope graph (#1452 box 3).
   *
   * Absent only where a test builds a program without one; production always
   * supplies the registry the run constructed.
   */
  readonly registry?: SymbolRegistry;
 
  /**
   * ADR-049: what the run's one target is settled from. Absent only where a
   * test builds a program that never asks for its target.
   */
  readonly target?: IRunTargetInputs;
  /**
   * #1175: the files that include a C or C++ header, directly or
   * transitively. A `#define` never reaches the symbol model, so in these a
   * name nothing binds may be a macro. Absent, no file does.
   */
  readonly filesReachingForeignHeaders?: ReadonlySet<string>;
}
 
export default IProgramInputs;