@@ -759,24 +759,19 @@ and expression_desc cxt ~(level : int) f x : cxt =
759
759
Ext_list. map_combine fields el (fun x ->
760
760
Js_op. Lit (Ext_ident. convert x)) ))
761
761
(* name convention of Record is slight different from modules*)
762
- | Caml_block (el , mutable_flag , _ , Blk_record {fields; record_repr } ) -> (
762
+ | Caml_block (el , mutable_flag , _ , Blk_record {fields} ) ->
763
763
if
764
764
Array. length fields <> 0
765
- && Ext_array. for_alli fields (fun i v -> string_of_int i = v)
765
+ && Ext_array. for_alli fields (fun i ( v , _ ) -> string_of_int i = v)
766
766
then expression_desc cxt ~level f (Array (el, mutable_flag))
767
767
else
768
- match record_repr with
769
- | Record_regular ->
770
- expression_desc cxt ~level f
771
- (Object (None , Ext_list. combine_array fields el (fun i -> Js_op. Lit i)))
772
- | Record_optional ->
773
- let fields =
774
- Ext_list. array_list_filter_map fields el (fun f x ->
775
- match x.expression_desc with
776
- | Undefined _ -> None
777
- | _ -> Some (Js_op. Lit f, x))
778
- in
779
- expression_desc cxt ~level f (Object (None , fields)))
768
+ let fields =
769
+ Ext_list. array_list_filter_map fields el (fun (f , opt ) x ->
770
+ match x.expression_desc with
771
+ | Undefined _ when opt -> None
772
+ | _ -> Some (Js_op. Lit f, x))
773
+ in
774
+ expression_desc cxt ~level f (Object (None , fields))
780
775
| Caml_block (el , _ , _ , Blk_poly_var _ ) -> (
781
776
match el with
782
777
| [tag; value] ->
0 commit comments