File tree Expand file tree Collapse file tree 6 files changed +181
-185
lines changed
Expand file tree Collapse file tree 6 files changed +181
-185
lines changed Original file line number Diff line number Diff line change 22let mapJsonObjectString f decoder (encoder : int -> Js.Json.t ) str =
33 let json = Melange_json. of_string str in
44 Melange_json.Of_json. (js_dict decoder json)
5- |> Js.Dict. map ~f: (fun [@u ] v -> f v)
5+ |> Js.Dict. map ~f: (fun[@ u] v -> f v)
66 |> Melange_json.To_json. js_dict encoder
77 |> Melange_json. to_string
88
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ let get_of_variant_case ?mark_as_seen ~variant ~polyvariant = function
77 | Vcs_ctx_variant ctx -> Attribute. get ?mark_as_seen variant ctx
88 | Vcs_ctx_polyvariant ctx -> Attribute. get ?mark_as_seen polyvariant ctx
99
10-
1110let get_of_variant ?mark_as_seen ~variant ~polyvariant = function
1211 | Vrt_ctx_variant ctx -> Attribute. get ?mark_as_seen variant ctx
1312 | Vrt_ctx_polyvariant ctx -> Attribute. get ?mark_as_seen polyvariant ctx
@@ -24,8 +23,6 @@ let vcs_attr_json_name =
2423 let polyvariant = attr_json_name Attribute.Context. rtag in
2524 get_of_variant_case ~variant ~polyvariant
2625
27-
28-
2926let attr_json_allow_any ctx = Attribute. declare_flag " json.allow_any" ctx
3027
3128let vcs_attr_json_allow_any =
Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ module Conv = struct
409409 let allow_any_constr =
410410 cs
411411 |> List. find_opt ~f: (fun cs ->
412- is_allow_any_constr (Vcs_ctx_variant cs))
412+ is_allow_any_constr (Vcs_ctx_variant cs))
413413 |> Option. map (fun cs e -> econstruct cs (Some e))
414414 in
415415 let cs =
@@ -479,13 +479,13 @@ module Conv = struct
479479 let allow_any_constr =
480480 cs
481481 |> List. find_opt ~f: (fun cs ->
482- is_allow_any_constr (Vcs_ctx_polyvariant cs))
482+ is_allow_any_constr (Vcs_ctx_polyvariant cs))
483483 |> Option. map (fun cs ->
484- match cs.prf_desc with
485- | Rinherit _ ->
486- failwith " [@allow_any] placed on inherit clause"
487- | Rtag (n , _ , _ ) ->
488- fun e -> pexp_variant ~loc: n.loc n.txt (Some e))
484+ match cs.prf_desc with
485+ | Rinherit _ ->
486+ failwith " [@allow_any] placed on inherit clause"
487+ | Rtag (n , _ , _ ) ->
488+ fun e -> pexp_variant ~loc: n.loc n.txt (Some e))
489489 in
490490 let cs =
491491 List. filter
Original file line number Diff line number Diff line change @@ -195,24 +195,23 @@ module To_json = struct
195195 let e =
196196 List. combine t.rcd_fields es
197197 |> List. fold_left ~init: ebnds ~f: (fun acc (ld , x ) ->
198- let key =
199- Option. value ~default: ld.pld_name (ld_attr_json_key ld)
200- in
201- let k = estring ~loc: key.loc key.txt in
202- let v = derive ld.pld_type x in
203- let ebnds =
204- match ld_drop_default ld with
205- | `No -> [% expr ([% e k], [% e v]) :: [% e ebnds]]
206- | `Drop_option ->
207- [% expr
208- match [% e x] with
209- | Stdlib.Option. None -> [% e ebnds]
210- | Stdlib.Option. Some _ ->
211- ([% e k], [% e v]) :: [% e ebnds]]
212- in
213- [% expr
214- let [% p pbnds] = [% e ebnds] in
215- [% e acc]])
198+ let key =
199+ Option. value ~default: ld.pld_name (ld_attr_json_key ld)
200+ in
201+ let k = estring ~loc: key.loc key.txt in
202+ let v = derive ld.pld_type x in
203+ let ebnds =
204+ match ld_drop_default ld with
205+ | `No -> [% expr ([% e k], [% e v]) :: [% e ebnds]]
206+ | `Drop_option ->
207+ [% expr
208+ match [% e x] with
209+ | Stdlib.Option. None -> [% e ebnds]
210+ | Stdlib.Option. Some _ -> ([% e k], [% e v]) :: [% e ebnds]]
211+ in
212+ [% expr
213+ let [% p pbnds] = [% e ebnds] in
214+ [% e acc]])
216215 in
217216 [% expr
218217 `Assoc
You can’t perform that action at this time.
0 commit comments