@@ -9,19 +9,19 @@ open Replacements.Util
99/// Emits a Fable expression that, when compiled, produces runtime calls
1010/// to construct a quotation AST. The input is the Fable.Expr captured
1111/// inside a Quote node; the output is a Fable.Expr that calls the
12- /// fable_quotation runtime library to build the AST at runtime.
12+ /// quotation runtime library to build the AST at runtime.
1313let rec emitQuotedExpr ( com : Compiler ) ( expr : Expr ) : Expr =
1414 match expr with
1515 | Value( kind, r) -> emitQuotedValue com kind r
1616
1717 | IdentExpr ident ->
1818 // Reference to a variable already introduced by a lambda/let in the quotation.
19- // Emit: fableQuotation .mkVar(Var)
19+ // Emit: quotation .mkVar(Var)
2020 // We need a var reference. Create a var and then wrap it.
2121 let varExpr =
2222 Helper.LibCall(
2323 com,
24- " fableQuotation " ,
24+ " quotation " ,
2525 " mkQuotVar" ,
2626 Any,
2727 [
@@ -31,13 +31,13 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
3131 ]
3232 )
3333
34- Helper.LibCall( com, " fableQuotation " , " mkVar" , Any, [ varExpr ])
34+ Helper.LibCall( com, " quotation " , " mkVar" , Any, [ varExpr ])
3535
3636 | Lambda( arg, body, _ name) ->
3737 let varExpr =
3838 Helper.LibCall(
3939 com,
40- " fableQuotation " ,
40+ " quotation " ,
4141 " mkQuotVar" ,
4242 Any,
4343 [
@@ -48,7 +48,7 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
4848 )
4949
5050 let bodyExpr = emitQuotedExpr com body
51- Helper.LibCall( com, " fableQuotation " , " mkLambda" , Any, [ varExpr; bodyExpr ])
51+ Helper.LibCall( com, " quotation " , " mkLambda" , Any, [ varExpr; bodyExpr ])
5252
5353 | Delegate( args, body, _ name, _ tags) ->
5454 // Multi-arg delegate: nest as curried lambdas
@@ -59,7 +59,7 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
5959 let varExpr =
6060 Helper.LibCall(
6161 com,
62- " fableQuotation " ,
62+ " quotation " ,
6363 " mkQuotVar" ,
6464 Any,
6565 [
@@ -70,15 +70,15 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
7070 )
7171
7272 let innerBody = nestLambdas rest body
73- Helper.LibCall( com, " fableQuotation " , " mkLambda" , Any, [ varExpr; innerBody ])
73+ Helper.LibCall( com, " quotation " , " mkLambda" , Any, [ varExpr; innerBody ])
7474
7575 nestLambdas args body
7676
7777 | Let( ident, value, body) ->
7878 let varExpr =
7979 Helper.LibCall(
8080 com,
81- " fableQuotation " ,
81+ " quotation " ,
8282 " mkQuotVar" ,
8383 Any,
8484 [
@@ -91,13 +91,13 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
9191 let valueExpr = emitQuotedExpr com value
9292 let bodyExpr = emitQuotedExpr com body
9393
94- Helper.LibCall( com, " fableQuotation " , " mkLet" , Any, [ varExpr; valueExpr; bodyExpr ])
94+ Helper.LibCall( com, " quotation " , " mkLet" , Any, [ varExpr; valueExpr; bodyExpr ])
9595
9696 | IfThenElse( guardExpr, thenExpr, elseExpr, _ r) ->
9797 let guard = emitQuotedExpr com guardExpr
9898 let thenE = emitQuotedExpr com thenExpr
9999 let elseE = emitQuotedExpr com elseExpr
100- Helper.LibCall( com, " fableQuotation " , " mkIfThenElse" , Any, [ guard; thenE; elseE ])
100+ Helper.LibCall( com, " quotation " , " mkIfThenElse" , Any, [ guard; thenE; elseE ])
101101
102102 | CurriedApply( applied, args, _ typ, _ r) ->
103103 // Emit nested applications: Application(Application(f, a1), a2)
@@ -107,7 +107,7 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
107107 |> List.fold
108108 ( fun acc arg ->
109109 let argExpr = emitQuotedExpr com arg
110- Helper.LibCall( com, " fableQuotation " , " mkApplication" , Any, [ acc; argExpr ])
110+ Helper.LibCall( com, " quotation " , " mkApplication" , Any, [ acc; argExpr ])
111111 )
112112 appliedExpr
113113
@@ -126,7 +126,7 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
126126
127127 let argExprs = info.Args |> List.map ( emitQuotedExpr com) |> makeArray Any
128128
129- Helper.LibCall( com, " fableQuotation " , " mkCall" , Any, [ instanceExpr; methodExpr; argExprs ])
129+ Helper.LibCall( com, " quotation " , " mkCall" , Any, [ instanceExpr; methodExpr; argExprs ])
130130
131131 | Sequential exprs ->
132132 match exprs with
@@ -135,7 +135,7 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
135135 | first :: rest ->
136136 let restExpr = emitQuotedExpr com ( Sequential rest)
137137 let firstExpr = emitQuotedExpr com first
138- Helper.LibCall( com, " fableQuotation " , " mkSequential" , Any, [ firstExpr; restExpr ])
138+ Helper.LibCall( com, " quotation " , " mkSequential" , Any, [ firstExpr; restExpr ])
139139
140140 | Operation( kind, _ tags, _ typ, _ r) ->
141141 // Represent operations as calls to the operator method
@@ -187,21 +187,21 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
187187
188188 let argExprs = args |> List.map ( emitQuotedExpr com) |> makeArray Any
189189
190- Helper.LibCall( com, " fableQuotation " , " mkCall" , Any, [ instanceExpr; methodExpr; argExprs ])
190+ Helper.LibCall( com, " quotation " , " mkCall" , Any, [ instanceExpr; methodExpr; argExprs ])
191191
192192 | Get( expr, kind, _ typ, _ r) ->
193193 let target = emitQuotedExpr com expr
194194
195195 match kind with
196- | TupleIndex index -> Helper.LibCall( com, " fableQuotation " , " mkTupleGet" , Any, [ target; makeIntConst index ])
197- | UnionTag -> Helper.LibCall( com, " fableQuotation " , " mkUnionTag" , Any, [ target ])
196+ | TupleIndex index -> Helper.LibCall( com, " quotation " , " mkTupleGet" , Any, [ target; makeIntConst index ])
197+ | UnionTag -> Helper.LibCall( com, " quotation " , " mkUnionTag" , Any, [ target ])
198198 | UnionField info ->
199- Helper.LibCall( com, " fableQuotation " , " mkUnionField" , Any, [ target; makeIntConst info.FieldIndex ])
200- | FieldGet info -> Helper.LibCall( com, " fableQuotation " , " mkFieldGet" , Any, [ target; makeStrConst info.Name ])
199+ Helper.LibCall( com, " quotation " , " mkUnionField" , Any, [ target; makeIntConst info.FieldIndex ])
200+ | FieldGet info -> Helper.LibCall( com, " quotation " , " mkFieldGet" , Any, [ target; makeStrConst info.Name ])
201201 | _ ->
202202 // ListHead, ListTail, OptionValue, ExprGet — fall through
203203 let msg = " Unsupported quotation Get kind"
204- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
204+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
205205
206206 | Set( expr, kind, _ typ, value, _ r) ->
207207 let target = emitQuotedExpr com expr
@@ -210,12 +210,12 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
210210 match kind with
211211 | ValueSet ->
212212 // Mutable variable set: expr is the ident, value is the new value
213- Helper.LibCall( com, " fableQuotation " , " mkVarSet" , Any, [ target; valueExpr ])
213+ Helper.LibCall( com, " quotation " , " mkVarSet" , Any, [ target; valueExpr ])
214214 | FieldSet fieldName ->
215- Helper.LibCall( com, " fableQuotation " , " mkFieldSet" , Any, [ target; makeStrConst fieldName; valueExpr ])
215+ Helper.LibCall( com, " quotation " , " mkFieldSet" , Any, [ target; makeStrConst fieldName; valueExpr ])
216216 | _ ->
217217 let msg = " Unsupported quotation Set kind"
218- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
218+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
219219
220220 | TypeCast( innerExpr, _ typ) ->
221221 // Coerce/cast: just emit the inner expression for now
@@ -228,48 +228,47 @@ let rec emitQuotedExpr (com: Compiler) (expr: Expr) : Expr =
228228 | [ ([], body) ] -> emitQuotedExpr com body
229229 | _ ->
230230 let msg = " Unsupported quotation node: DecisionTree"
231- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
231+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
232232
233233 | DecisionTreeSuccess( idx, boundValues, _ typ) ->
234234 match boundValues with
235235 | [] -> emitQuotedExpr com ( Value( UnitConstant, None))
236236 | [ single ] -> emitQuotedExpr com single
237237 | _ ->
238238 let msg = " Unsupported quotation node: DecisionTreeSuccess"
239- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
239+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
240240
241241 | _ ->
242242 // Unsupported node: emit an error value
243243 let msg = $" Unsupported quotation node: %A {expr.GetType().Name}"
244244
245- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
245+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
246246
247247and private emitQuotedValue ( com : Compiler ) ( kind : ValueKind ) ( _r : SourceLocation option ) : Expr =
248248 match kind with
249- | BoolConstant b -> Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeBoolConst b; makeStrConst " bool" ])
249+ | BoolConstant b -> Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeBoolConst b; makeStrConst " bool" ])
250250
251251 | NumberConstant( NumberValue.Int32 i, _) ->
252- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeIntConst i; makeStrConst " int32" ])
252+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeIntConst i; makeStrConst " int32" ])
253253
254254 | NumberConstant( NumberValue.Float64 f, _) ->
255255 let floatExpr = Value( NumberConstant( NumberValue.Float64 f, NumberInfo.Empty), None)
256- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ floatExpr; makeStrConst " float64" ])
256+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ floatExpr; makeStrConst " float64" ])
257257
258- | StringConstant s ->
259- Helper.LibCall( com, " fableQuotation" , " mkValue" , Any, [ makeStrConst s; makeStrConst " string" ])
258+ | StringConstant s -> Helper.LibCall( com, " quotation" , " mkValue" , Any, [ makeStrConst s; makeStrConst " string" ])
260259
261260 | UnitConstant ->
262- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ Value( UnitConstant, None); makeStrConst " unit" ])
261+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ Value( UnitConstant, None); makeStrConst " unit" ])
263262
264- | Null _ -> Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " null" ])
263+ | Null _ -> Helper.LibCall( com, " quotation " , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " null" ])
265264
266265 | CharConstant c ->
267- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ Value( CharConstant c, None); makeStrConst " char" ])
266+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ Value( CharConstant c, None); makeStrConst " char" ])
268267
269268 | NewTuple( values, _ isStruct) ->
270269 let emittedValues = values |> List.map ( emitQuotedExpr com) |> makeArray Any
271270
272- Helper.LibCall( com, " fableQuotation " , " mkNewTuple" , Any, [ emittedValues ])
271+ Helper.LibCall( com, " quotation " , " mkNewTuple" , Any, [ emittedValues ])
273272
274273 | NewUnion( values, tag, entRef, _ genArgs) ->
275274 let entName =
@@ -279,13 +278,7 @@ and private emitQuotedValue (com: Compiler) (kind: ValueKind) (_r: SourceLocatio
279278
280279 let emittedValues = values |> List.map ( emitQuotedExpr com) |> makeArray Any
281280
282- Helper.LibCall(
283- com,
284- " fableQuotation" ,
285- " mkNewUnion" ,
286- Any,
287- [ makeStrConst entName; makeIntConst tag; emittedValues ]
288- )
281+ Helper.LibCall( com, " quotation" , " mkNewUnion" , Any, [ makeStrConst entName; makeIntConst tag; emittedValues ])
289282
290283 | NewRecord( values, entRef, _ genArgs) ->
291284 let fieldNames =
@@ -295,28 +288,27 @@ and private emitQuotedValue (com: Compiler) (kind: ValueKind) (_r: SourceLocatio
295288
296289 let emittedValues = values |> List.map ( emitQuotedExpr com) |> makeArray Any
297290
298- Helper.LibCall( com, " fableQuotation " , " mkNewRecord" , Any, [ fieldNames; emittedValues ])
291+ Helper.LibCall( com, " quotation " , " mkNewRecord" , Any, [ fieldNames; emittedValues ])
299292
300293 | NewOption( value, _ typ, _ isStruct) ->
301294 match value with
302295 | Some v ->
303296 let emitted = emitQuotedExpr com v
304- Helper.LibCall( com, " fableQuotation" , " mkValue" , Any, [ emitted; makeStrConst " option" ])
305- | None ->
306- Helper.LibCall( com, " fableQuotation" , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " option" ])
297+ Helper.LibCall( com, " quotation" , " mkValue" , Any, [ emitted; makeStrConst " option" ])
298+ | None -> Helper.LibCall( com, " quotation" , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " option" ])
307299
308300 | NewList( headAndTail, _ typ) ->
309301 match headAndTail with
310302 | Some( head, tail) ->
311303 let headExpr = emitQuotedExpr com head
312304 let tailExpr = emitQuotedExpr com tail
313- Helper.LibCall( com, " fableQuotation " , " mkNewList" , Any, [ headExpr; tailExpr ])
314- | None -> Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " list" ])
305+ Helper.LibCall( com, " quotation " , " mkNewList" , Any, [ headExpr; tailExpr ])
306+ | None -> Helper.LibCall( com, " quotation " , " mkValue" , Any, [ Value( Null Any, None); makeStrConst " list" ])
315307
316308 | _ ->
317309 // Fallback for other value kinds
318310 let msg = " Unsupported quotation value"
319- Helper.LibCall( com, " fableQuotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
311+ Helper.LibCall( com, " quotation " , " mkValue" , Any, [ makeStrConst msg; makeStrConst " string" ])
320312
321313and private typeToString ( t : Type ) : string =
322314 match t with
0 commit comments