All files / transpiler/types/symbols IStructSymbolState.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                                                                               
/**
 * **Every field here must be required — never optional.** The cache's defense
 * against silently dropping one is a compile error from
 * `TJsonSafe<Required<IStructSymbolState>>`, and an optional field would be
 * satisfied by omitting it: `new Set(undefined)` is an empty Set, which is
 * exactly #1225's failure mode (a warm build that never heard of a fact the
 * cold build knows). `Required<...>` at the use sites makes that a compile
 * error rather than a convention, but keeping fields required keeps the
 * intent legible here too.
 *
 * Issue #958: Immutable struct symbol state managed via immer produce().
 * All mutations are additive-only — no unmark/delete operations.
 * Resolution (e.g., "is this type truly opaque?") happens at query time.
 */
interface IStructSymbolState {
  /** Typedef names declared with forward-declared structs (additive only) */
  opaqueTypes: Set<string>;
  /** ALL typedef struct types from C headers: name → sourceFile (additive only) */
  typedefStructTypes: Map<string, string>;
  /** Struct tag → typedef name (e.g., "_widget_t" → "widget_t") */
  structTagAliases: Map<string, string>;
  /** Typedef name → struct tag (reverse of structTagAliases) */
  typedefToTag: Map<string, string>;
  /** Struct tags that have full definitions (bodies) */
  structTagsWithBodies: Set<string>;
  /**
   * Typedefs of a pointer to a struct, e.g. `typedef struct opaque_t* handle_t`.
   *
   * Issue #957 rightly keeps these out of opaqueTypes -- they are already
   * pointers, not incomplete structs. But the fact was then discarded, and a
   * generated header cannot tell one from a plain external struct: it emitted
   * `typedef struct handle_t handle_t;`, declaring a different type than the
   * real definition (#1164). Recorded here so both the forward-declaration
   * filter and the include-propagation check can ask.
   */
  pointerTypedefs: Set<string>;
}
 
export default IStructSymbolState;