All files / transpiler/types ICachedFileEntry.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                                                                                                             
/**
 * Cached entry for a single header file
 */
 
import IStructFieldInfo from "./symbols/IStructFieldInfo";
import IStructSymbolState from "./symbols/IStructSymbolState";
import TJsonSafe from "../../utils/types/TJsonSafe";
import TJsonValue from "../../utils/types/TJsonValue";
 
interface ICachedFileEntry {
  /** Absolute path to the header file */
  filePath: string;
  /** Cache key for invalidation (format: "mtime:<timestamp>" or future "hash:<sha256>") */
  cacheKey: string;
  /**
   * Symbols extracted from this file, encoded by `JsonCodec`.
   *
   * ADR-055 Phase 7 removed the legacy flat `ISymbol` model everywhere except
   * here, where it survived as `ISerializedSymbol` plus an adapter in each
   * direction. Because those adapters named fields one at a time, every fact
   * the symbol model gained had to be re-taught to them by hand — and four
   * bugs (#985, #1104, #1214, #1225) were fields nobody added.
   *
   * Issue #1225 finishes that migration: the real `TCSymbol`/`TCppSymbol` go
   * through a generic encoder that never enumerates fields, so it cannot drop
   * one. Typed as JSON because that is what the file honestly holds until
   * `CachedSymbolReader` validates it.
   */
  symbols: TJsonValue[];
  /** Struct fields: struct name -> (field name -> field info) */
  structFields: Record<string, Record<string, IStructFieldInfo>>;
  /** Issue #196 Bug 3: Struct names requiring 'struct' keyword in C */
  needsStructKeyword?: string[];
  /** Issue #208: Enum bit widths from typed enums (enum name -> bit width) */
  enumBitWidth?: Record<string, number>;
  /**
   * Issue #1225: the whole struct symbol state, captured as one value.
   *
   * Previously four of its six fields were listed here individually, which is
   * why `pointerTypedefs` could be added by #1164 and silently not persisted.
   * The type is derived from `IStructSymbolState`, so a new field there is a
   * compile error until it is captured.
   */
  structState: TJsonSafe<Required<IStructSymbolState>>;
  /**
   * Issue #985: This header could not be preprocessed standalone and fell back
   * to raw content, so its cached symbols are degraded (phantom struct bodies,
   * missing/by-value framework signatures). Persisted so a warm-cache build
   * still triggers the external-declaration recovery pass and re-applies the fix.
   */
  preprocessFailed?: boolean;
}
 
export default ICachedFileEntry;