@@ -798,25 +798,66 @@ and
798798 ->
799799 (* Note that, if we ignore more than tag [0] we loose some information
800800 with regard tag *)
801- begin match tag.expression_desc, tag_info with
802801
803- | Number (Int { i = 0l ; _}) ,
804- (Blk_tuple | Blk_array | Blk_variant _ | Blk_record _ | Blk_na | Blk_module _
805- | Blk_constructor (_, 1 ) (* Sync up with {!Js_dump}*)
806- )
807- -> expression_desc cxt l f (Array (el, mutable_flag))
808802 (* TODO: for numbers like 248, 255 we can reverse engineer to make it
809803 [Obj.xx_flag], but we can not do this in runtime libraries
810804 *)
811805
812- | _, _
813- ->
814- P. string f L. caml_block;
815- P. string f L. dot ;
816- P. string f L. caml_block_create;
817- P. paren_group f 1
818- (fun _ -> arguments cxt f [tag; E. array mutable_flag el])
819- end
806+ if Js_fold_basic. needBlockRuntime tag tag_info then begin
807+ match tag_info with
808+ | Blk_record labels ->
809+ P. string f L. caml_block;
810+ P. string f L. dot ;
811+ P. string f L. block_record;
812+ P. paren_group f 1
813+ (fun _ -> arguments cxt f
814+ [E. array Immutable
815+ (Ext_array. to_list_f E. str labels);
816+ E. array mutable_flag
817+ (List. map (fun (x : J.expression ) -> {x with comment = None }) el) ]
818+ )
819+ | Blk_module (Some labels ) ->
820+ P. string f L. caml_block;
821+ P. string f L. dot ;
822+ P. string f L. block_local_module;
823+ P. paren_group f 1
824+ (fun _ -> arguments cxt f
825+ [E. array Immutable
826+ (Ext_list. map E. str labels);
827+ E. array mutable_flag
828+ (List. map (fun (x :J.expression ) -> {x with comment = None }) el)
829+ ]
830+ )
831+ | Blk_variant name ->
832+ P. string f L. caml_block;
833+ P. string f L. dot ;
834+ P. string f L. block_poly_var;
835+ P. paren_group f 1
836+ (fun _ -> arguments cxt f
837+ [
838+ E. str name;
839+ E. array mutable_flag el]
840+ )
841+ | Blk_constructor (name ,_ ) when ! Js_config. debug ->
842+ P. string f L. caml_block;
843+ P. string f L. dot ;
844+ P. string f L. block_variant;
845+ P. paren_group f 1
846+ (fun _ -> arguments cxt f
847+ [E. str name; E. array mutable_flag el])
848+
849+ | _ ->
850+ begin
851+ P. string f L. caml_block;
852+ P. string f L. dot ;
853+ P. string f L. caml_block_create;
854+ P. paren_group f 1
855+ (fun _ -> arguments cxt f [tag; E. array mutable_flag el])
856+ end
857+ end
858+ else
859+ expression_desc cxt l f (Array (el, mutable_flag))
860+
820861 | Caml_block_tag e ->
821862 P. group f 1 (fun _ ->
822863 let cxt = expression 15 cxt f e in
0 commit comments