/** * Target-aware fixture-IR lowering for the differential harness. * * Phase 1 PR-3b: extracted from `ts-leg.ts` so the Python leg can reuse the * same primitive translations with target-appropriate runtime syntax. * * Three fixture-only IR nodes get translated into KERN-native shapes before * codegen — production emitters never see them: * * - `__trace {event:E}` → `do value="()"` * - `return {value:V}` → `throw value="new __KernReturn()"` (TS) * / `throw value="_KernReturn()"` (Python) * - `throw {errorKind:K}` → `throw value="new __KernThrow()"` (TS) * / `throw value="_KernThrow()"` (Python) * - `__breakIfEqual {name:N,value:V}` → `if cond=" == " > break` * - `__assignIndex {target:T,index:I,value:V}` → `assign target="T[I]" value="V"` * * `break` and `continue` pass through (they are real KERN body-stmts in both * targets). * * The two targets MUST use identifiers compatible with their host language's * literal/identifier syntax: * - TS uses `new` for instantiation; Python does not. * - TS booleans are `true/false`; Python is `True/False`. * - TS uses `null`; Python uses `None`. * - JSON object key order is non-deterministic in some engines; we sort * keys to keep the inlined literal stable across runs. */ import type { IRNode } from '../../types.js'; export type LowerTarget = 'ts' | 'python'; /** * Serialize a fixture-supplied value as a TARGET-language literal that can * be embedded inside `do value="..."` or `throw value="..."`. Deterministic: * object keys are sorted; arrays preserve order; nested values recurse. * * Restricted to a JSON-shaped subset (primitive / array / plain object) * plus `null`/`undefined`. Any unsupported type (functions, symbols, * Map, Set, RegExp, etc.) throws — fixture authors must keep values in * the cross-language portable subset. */ export declare function serializeValue(value: unknown, target: LowerTarget): string; /** * Target-aware lowering. Pure: returns a fresh tree (props + children * cloned shallowly) so caller mutations cannot leak into the result. * * @throws when a fixture node carries malformed props (missing `event`, * non-string `errorKind`). Fail loud, not silently. */ export declare function lowerFixtureForTarget(node: IRNode, target: LowerTarget): IRNode;