import { LocationRange } from "../ast/types.js"; import { SquiggleDeserializationVisitor, SquiggleSerializationVisitor } from "../serialization/squiggle.js"; import { AnyExpressionIR, IR, IRContent, IRContentByKind, LambdaIRParameter, StatementIR } from "./types.js"; type SerializedLambdaIRParameter = Omit & { annotation?: number; }; type SerializedIRContentByKindGeneric = Omit, "value"> & { value: ReplaceValue; }; type SerializedIRContentByKindObjectLike["value"], ReplaceFields> = Omit, "value"> & { value: Omit["value"], SkipFields> & ReplaceFields; }; export type SerializedIRContent = Exclude | SerializedIRContentByKindGeneric<"Value", number> | SerializedIRContentByKindObjectLike<"Block", "statements" | "result", { statements: number[]; result: number; }> | SerializedIRContentByKindObjectLike<"Program", "statements" | "result", { statements: number[]; result: number | null; }> | SerializedIRContentByKindObjectLike<"Ternary", "condition" | "ifTrue" | "ifFalse", { condition: number; ifTrue: number; ifFalse: number; }> | SerializedIRContentByKindObjectLike<"Assign", "right", { right: number; }> | SerializedIRContentByKindObjectLike<"Call", "fn" | "args", { fn: number; args: number[]; }> | SerializedIRContentByKindObjectLike<"Lambda", "parameters" | "body", { parameters: SerializedLambdaIRParameter[]; body: number; }> | SerializedIRContentByKindGeneric<"Array", number[]> | SerializedIRContentByKindGeneric<"Dict", [number, number][]>; export type SerializedIR = SerializedIRContent & { location: LocationRange; }; export declare function serializeIR(ir: IR, visit: SquiggleSerializationVisitor): { location: LocationRange; kind: "StackRef"; value: number; } | { location: LocationRange; kind: "CaptureRef"; value: number; } | { location: LocationRange; kind: "Value"; value: number; } | { location: LocationRange; kind: "Block"; value: Omit<{ statements: StatementIR[]; result: AnyExpressionIR; }, "statements" | "result"> & { statements: number[]; result: number; }; } | { location: LocationRange; kind: "Program"; value: Omit<{ statements: StatementIR[]; result: AnyExpressionIR | undefined; exports: string[]; bindings: Record; }, "statements" | "result"> & { statements: number[]; result: number | null; }; } | { location: LocationRange; kind: "Ternary"; value: Omit<{ condition: AnyExpressionIR; ifTrue: AnyExpressionIR; ifFalse: AnyExpressionIR; }, "condition" | "ifTrue" | "ifFalse"> & { condition: number; ifTrue: number; ifFalse: number; }; } | { location: LocationRange; kind: "Assign"; value: Omit<{ left: string; right: AnyExpressionIR; }, "right"> & { right: number; }; } | { location: LocationRange; kind: "Call"; value: Omit<{ fn: AnyExpressionIR; args: AnyExpressionIR[]; as: "call" | "decorate"; }, "args" | "fn"> & { fn: number; args: number[]; }; } | { location: LocationRange; kind: "Lambda"; value: Omit<{ name?: string; captures: import("./types.js").Ref[]; parameters: LambdaIRParameter[]; body: AnyExpressionIR; }, "body" | "parameters"> & { parameters: SerializedLambdaIRParameter[]; body: number; }; } | { location: LocationRange; kind: "Array"; value: number[]; } | { location: LocationRange; kind: "Dict"; value: [number, number][]; }; export declare function assertExpression(ir: IR): AnyExpressionIR; export declare function deserializeIR(ir: SerializedIR, visit: SquiggleDeserializationVisitor): IR; export {}; //# sourceMappingURL=serialize.d.ts.map