@@ -384188,169 +384188,7 @@ let rec
384188
384188
| _ -> false)
384189
384189
| Lstaticraise(id,ls) ->
384190
384190
(match l2 with Lstaticraise(id1,ls1) ->
384191
- id = id1 && eq_approx_list ls ls1
384192
- | _ -> false)
384193
- | Lprim info1 ->
384194
- (match l2 with
384195
- Lprim info2 ->
384196
- Lam_primitive.eq_primitive_approx info1.primitive info2.primitive &&
384197
- eq_approx_list info1.args info2.args
384198
- | _ -> false)
384199
- | Lstringswitch _ -> false
384200
- | Lfunction _
384201
- | Llet (_,_,_,_)
384202
- | Lletrec _
384203
- | Lswitch _
384204
- | Lstaticcatch _
384205
- | Ltrywith _
384206
- | Lfor (_,_,_,_,_)
384207
- | Lsend _
384208
- -> false
384209
-
384210
- and eq_approx_list ls ls1 = Ext_list.for_all2_no_exn ls ls1 eq_approx
384211
-
384212
-
384213
-
384214
-
384215
- let switch lam (lam_switch : lambda_switch) : t =
384216
- match lam with
384217
- | Lconst ((Const_pointer (i,_) | (Const_int {value = i})))
384218
- ->
384219
- Ext_list.assoc_by_int lam_switch.sw_consts i lam_switch.sw_failaction
384220
- | Lconst (Const_block (i,_,_)) ->
384221
- Ext_list.assoc_by_int lam_switch.sw_blocks i lam_switch.sw_failaction
384222
- | _ ->
384223
- Lswitch(lam,lam_switch)
384224
-
384225
- let stringswitch (lam : t) cases default : t =
384226
- match lam with
384227
- | Lconst (Const_string a) ->
384228
- Ext_list.assoc_by_string cases a default
384229
- | _ -> Lstringswitch(lam, cases, default)
384230
-
384231
-
384232
- let true_ : t =
384233
- Lconst (Const_js_true)
384234
-
384235
- let false_ : t =
384236
- Lconst (Const_js_false)
384237
-
384238
- let unit : t = Lconst Const_js_undefined
384239
-
384240
-
384241
-
384242
-
384243
-
384244
- let rec seq (a : t) b : t =
384245
- match a with
384246
- | Lprim
384247
- {primitive = Pmakeblock(_);
384248
- args= x::xs} ->
384249
- seq (Ext_list.fold_left xs x seq ) b
384250
- | Lprim {primitive = Pnull_to_opt | Pundefined_to_opt | Pnull_undefined_to_opt; args = [a]}
384251
- -> seq a b
384252
- | _ ->
384253
- Lsequence (a, b)
384254
-
384255
-
384256
- let var id : t = Lvar id
384257
- let global_module id = Lglobal_module id
384258
- let const ct : t = Lconst ct
384259
- let function_ ~arity ~params ~body : t =
384260
- Lfunction { arity; params ; body}
384261
-
384262
- let let_ kind id e body : t
384263
- = Llet (kind,id,e,body)
384264
- let letrec bindings body : t =
384265
- Lletrec(bindings,body)
384266
- let while_ a b : t =
384267
- Lwhile(a,b)
384268
-
384269
- let try_ body id handler : t =
384270
- Ltrywith(body,id,handler)
384271
-
384272
- let for_ v e1 e2 dir e3 : t =
384273
- Lfor(v,e1,e2,dir,e3)
384274
-
384275
- let assign v l : t = Lassign(v,l)
384276
- let send u m o ll v : t =
384277
- Lsend(u, m, o, ll, v)
384278
- let staticcatch a b c : t = Lstaticcatch(a,b,c)
384279
- let staticraise a b : t = Lstaticraise(a,b)
384280
-
384281
-
384282
- module Lift = struct
384283
- let int i : t =
384284
- Lconst ((Const_int {value = i; comment = None}))
384285
-
384286
-
384287
- (* let int32 i : t =
384288
- Lconst ((Const_int32 i)) *)
384289
-
384290
- let bool b = if b then true_ else false_
384291
-
384292
- (* ATTENTION: [float, nativeint] constant propogaton is not done
384293
- yet , due to cross platform problem
384294
- *)
384295
- (* let float b : t =
384296
- Lconst ((Const_float b)) *)
384297
-
384298
- (* let nativeint b : t =
384299
- Lconst ((Const_nativeint b)) *)
384300
-
384301
- let int32 b : t =
384302
- Lconst ((Const_int32 b))
384303
-
384304
- let int64 b : t =
384305
- Lconst ((Const_int64 b))
384306
- let string b : t =
384307
- Lconst ((Const_string (b)))
384308
- let char b : t =
384309
- Lconst ((Const_char b))
384310
- end
384311
-
384312
-
384313
-
384314
- let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
384315
- let default () : t = Lprim { primitive = prim ;args; loc} in
384316
- match args with
384317
- | [Lconst a] ->
384318
- begin match prim, a with
384319
- | Pnegint, Const_int {value = a}
384320
- -> Lift.int (- a)
384321
- (* | Pfloatofint, ( (Const_int a)) *)
384322
- (* -> Lift.float (float_of_int a) *)
384323
- | Pintoffloat, ( (Const_float a))
384324
- ->
384325
- Lift.int (int_of_float (float_of_string a))
384326
- (* | Pnegfloat -> Lift.float (-. a) *)
384327
- (* | Pabsfloat -> Lift.float (abs_float a) *)
384328
- | Pstringlength, Const_string a
384329
- ->
384330
- Lift.int (String.length a)
384331
- (* | Pnegbint Pnativeint, ( (Const_nativeint i)) *)
384332
- (* -> *)
384333
- (* Lift.nativeint (Nativeint.neg i) *)
384334
- | Pnegbint Pint32, Const_int32 a
384335
- ->
384336
- Lift.int32 (Int32.neg a)
384337
- | Pnegbint Pint64, Const_int64 a
384338
- ->
384339
- Lift.int64 (Int64.neg a)
384340
- | Pnot, Const_js_true -> false_
384341
- | Pnot, Const_js_false -> true_
384342
- | Pnot , Const_pointer (a,_)
384343
- -> Lift.bool (a = 0 )
384344
- | _ -> default ()
384345
- end
384346
-
384347
-
384348
- | [Lconst a ; Lconst b] ->
384349
- begin match prim, a, b with
384350
- | Pbintcomp(_, cmp), (Const_int32 a), (Const_int32 b)
384351
- -> Lift.bool (Lam_compat.cmp_int32 cmp a b)
384352
- | Pbintcomp(_, cmp), (Const_int64 a), (Const_int64 b)
384353
- -> Lift.bool (Lam_compat.cmp_int64 cmp a b)
384191
+ id = id1 t64 cmp a b)
384354
384192
| Pbintcomp(_, cmp), (Const_nativeint a), (Const_nativeint b)
384355
384193
-> Lift.bool (Lam_compat.cmp_nativeint cmp a b)
384356
384194
| Pfloatcomp cmp, (Const_float a), (Const_float b)
@@ -410279,8 +410117,11 @@ let jsxMapper () =
410279
410117
} -> ((fun a -> a), false, unerasableIgnoreExp expression)
410280
410118
(* let make = (prop) => ... *)
410281
410119
| {
410282
- pexp_desc = Pexp_fun (_nolabel, _default, _pattern, _internalExpression)
410283
- } -> raise (Invalid_argument "if your component doesn't take any props use () or _ instead of a name as your argument")
410120
+ pexp_desc = Pexp_fun (_nolabel, _default, _pattern, _internalExpression);
410121
+ pexp_loc
410122
+ } ->
410123
+ Location.raise_errorf ~loc:pexp_loc
410124
+ "Make sure to use labeled arguments for props, if your component doesn't take any props use () or _ instead of a name as your argument"
410284
410125
(* let make = {let foo = bar in (~prop) => ...} *)
410285
410126
| {
410286
410127
pexp_desc = Pexp_let (recursive, vbs, internalExpression)
@@ -410493,11 +410334,11 @@ let jsxMapper () =
410493
410334
| {loc; txt = Ldot (modulePath, ("createElement" | "make"))} ->
410494
410335
(match !jsxVersion with
410495
410336
410496
- # 933 "syntax/reactjs_jsx_ppx.cppo.ml"
410337
+ # 936 "syntax/reactjs_jsx_ppx.cppo.ml"
410497
410338
| None
410498
410339
| Some 2 -> transformUppercaseCall modulePath mapper loc attrs callExpression callArguments
410499
410340
410500
- # 939 "syntax/reactjs_jsx_ppx.cppo.ml"
410341
+ # 942 "syntax/reactjs_jsx_ppx.cppo.ml"
410501
410342
| Some 3 -> transformUppercaseCall3 modulePath mapper loc attrs callExpression callArguments
410502
410343
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
410503
410344
@@ -410507,11 +410348,11 @@ let jsxMapper () =
410507
410348
| {loc; txt = Lident id} ->
410508
410349
(match !jsxVersion with
410509
410350
410510
- # 948 "syntax/reactjs_jsx_ppx.cppo.ml"
410351
+ # 951 "syntax/reactjs_jsx_ppx.cppo.ml"
410511
410352
| None
410512
410353
| Some 2 -> transformLowercaseCall mapper loc attrs callArguments id
410513
410354
410514
- # 954 "syntax/reactjs_jsx_ppx.cppo.ml"
410355
+ # 957 "syntax/reactjs_jsx_ppx.cppo.ml"
410515
410356
| Some 3 -> transformLowercaseCall3 mapper loc attrs callArguments id
410516
410357
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
410517
410358
@@ -411331,8 +411172,11 @@ let jsxMapper () =
411331
411172
} -> ((fun a -> a), false, unerasableIgnoreExp expression)
411332
411173
(* let make = (prop) => ... *)
411333
411174
| {
411334
- pexp_desc = Pexp_fun (_nolabel, _default, _pattern, _internalExpression)
411335
- } -> raise (Invalid_argument "if your component doesn't take any props use () or _ instead of a name as your argument")
411175
+ pexp_desc = Pexp_fun (_nolabel, _default, _pattern, _internalExpression);
411176
+ pexp_loc
411177
+ } ->
411178
+ Location.raise_errorf ~loc:pexp_loc
411179
+ "Make sure to use labeled arguments for props, if your component doesn't take any props use () or _ instead of a name as your argument"
411336
411180
(* let make = {let foo = bar in (~prop) => ...} *)
411337
411181
| {
411338
411182
pexp_desc = Pexp_let (recursive, vbs, internalExpression)
@@ -411545,11 +411389,11 @@ let jsxMapper () =
411545
411389
| {loc; txt = Ldot (modulePath, ("createElement" | "make"))} ->
411546
411390
(match !jsxVersion with
411547
411391
411548
- # 936 "syntax/reactjs_jsx_ppx.cppo.ml"
411392
+ # 939 "syntax/reactjs_jsx_ppx.cppo.ml"
411549
411393
| Some 2 -> transformUppercaseCall modulePath mapper loc attrs callExpression callArguments
411550
411394
| None
411551
411395
411552
- # 939 "syntax/reactjs_jsx_ppx.cppo.ml"
411396
+ # 942 "syntax/reactjs_jsx_ppx.cppo.ml"
411553
411397
| Some 3 -> transformUppercaseCall3 modulePath mapper loc attrs callExpression callArguments
411554
411398
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
411555
411399
@@ -411559,11 +411403,11 @@ let jsxMapper () =
411559
411403
| {loc; txt = Lident id} ->
411560
411404
(match !jsxVersion with
411561
411405
411562
- # 951 "syntax/reactjs_jsx_ppx.cppo.ml"
411406
+ # 954 "syntax/reactjs_jsx_ppx.cppo.ml"
411563
411407
| Some 2 -> transformLowercaseCall mapper loc attrs callArguments id
411564
411408
| None
411565
411409
411566
- # 954 "syntax/reactjs_jsx_ppx.cppo.ml"
411410
+ # 957 "syntax/reactjs_jsx_ppx.cppo.ml"
411567
411411
| Some 3 -> transformLowercaseCall3 mapper loc attrs callArguments id
411568
411412
| Some _ -> raise (Invalid_argument "JSX: the JSX version must be 2 or 3"))
411569
411413
0 commit comments