|
| 1 | +namespace Fable.Core.Quotations |
| 2 | + |
| 3 | +/// Serializable variable in a quotation expression. |
| 4 | +/// Matches the JSON shape produced by Fable's quotation runtime. |
| 5 | +type QuotVar = |
| 6 | + { |
| 7 | + Name: string |
| 8 | + Type: string |
| 9 | + IsMutable: bool |
| 10 | + } |
| 11 | + |
| 12 | +/// Serializable quotation expression tree. |
| 13 | +/// Designed for cross-platform JSON deserialization (e.g. via Thoth.Json) |
| 14 | +/// of quotations constructed on Fable JS/TS clients. |
| 15 | +/// |
| 16 | +/// JSON format: ["Tag", ...fields] arrays, e.g. ["Value", 42, "int32"] |
| 17 | +[<RequireQualifiedAccess>] |
| 18 | +type QuotExpr = |
| 19 | + | Value of value: obj * typeName: string |
| 20 | + | Var of var: QuotVar |
| 21 | + | Lambda of var: QuotVar * body: QuotExpr |
| 22 | + | Application of func: QuotExpr * arg: QuotExpr |
| 23 | + | Let of var: QuotVar * value: QuotExpr * body: QuotExpr |
| 24 | + | IfThenElse of guard: QuotExpr * thenExpr: QuotExpr * elseExpr: QuotExpr |
| 25 | + | Call of instance: QuotExpr option * methodName: string * args: QuotExpr array |
| 26 | + | Sequential of first: QuotExpr * second: QuotExpr |
| 27 | + | NewTuple of elements: QuotExpr array |
| 28 | + | TupleGet of tuple: QuotExpr * index: int |
| 29 | + | NewUnion of typeName: string * tag: int * fields: QuotExpr array |
| 30 | + | UnionTag of expr: QuotExpr |
| 31 | + | UnionField of expr: QuotExpr * index: int |
| 32 | + | NewRecord of fieldNames: string array * values: QuotExpr array |
| 33 | + | FieldGet of expr: QuotExpr * fieldName: string |
| 34 | + | FieldSet of expr: QuotExpr * fieldName: string * value: QuotExpr |
| 35 | + | VarSet of target: QuotExpr * value: QuotExpr |
| 36 | + | NewList of head: QuotExpr * tail: QuotExpr |
0 commit comments