@@ -95,32 +95,40 @@ module Curry_gen = struct
95
95
P. string f (Printf. sprintf " %d" len)
96
96
end
97
97
98
- let pp_block_dot f =
98
+ let block_dot f =
99
99
P. string f Js_runtime_modules. block;
100
100
P. string f L. dot
101
101
102
102
let pp_block_create f =
103
- pp_block_dot f ;
103
+ block_dot f ;
104
104
P. string f L. caml_block_create
105
105
106
- let pp_block_record f =
107
- pp_block_dot f ;
106
+ let dbg_block_dot f =
107
+ P. string f Js_runtime_modules. caml_chrome_block;
108
+ P. string f L. dot
109
+
110
+ let dbg_block_create f =
111
+ dbg_block_dot f ;
112
+ P. string f L. caml_block_create
113
+
114
+ let dbg_record f =
115
+ dbg_block_dot f ;
108
116
P. string f L. block_record
109
117
110
118
let dbg_local_module f =
111
- pp_block_dot f;
119
+ dbg_block_dot f;
112
120
P. string f L. block_local_module
113
121
114
122
let dbg_poly_var f =
115
- pp_block_dot f;
123
+ dbg_block_dot f;
116
124
P. string f L. block_poly_var
117
125
118
126
let dbg_simple_variant f =
119
- pp_block_dot f ;
127
+ dbg_block_dot f ;
120
128
P. string f L. block_simple_variant
121
129
122
130
let dbg_variant f =
123
- pp_block_dot f ;
131
+ dbg_block_dot f ;
124
132
P. string f L. block_variant
125
133
126
134
@@ -860,56 +868,62 @@ and expression_desc cxt (level:int) f x : cxt =
860
868
as an array, note exception or open variant it is outer-most is
861
869
simply an array
862
870
*)
863
- let needBlockRuntime = Js_block_runtime. needBlockRuntime tag tag_info in
864
- let is_debug = ! Js_config. debug in
865
- if not needBlockRuntime then
866
- expression_desc cxt level f (Array (el, mutable_flag))
867
- else (
868
- match tag_info with
869
- | Blk_record labels ->
870
- pp_block_record f ;
871
- P. paren_group f 1 (fun _ -> arguments cxt f
872
- [E. array Immutable
873
- (Ext_array. to_list_f E. str labels);
874
- E. array mutable_flag
875
- (Ext_list. map el drop_comment) ]
876
- )
877
- | Blk_module (Some labels ) ->
878
- dbg_local_module f;
879
- P. paren_group f 1 (fun _ -> arguments cxt f
880
- [E. array Immutable
881
- (Ext_list. map labels E. str);
882
- E. array mutable_flag
883
- (Ext_list. map el drop_comment)])
884
- | Blk_variant name ->
885
- dbg_poly_var f;
886
- P. paren_group f 1 (fun _ -> arguments cxt f [
887
- E. str name;
888
- E. array mutable_flag el])
889
- | Blk_constructor (name,number) when number = 1 && Js_block_runtime. tag_is_zero tag
890
- -> (* has to be debug mode *)
891
- dbg_simple_variant f ;
892
- P. paren_group f 1 (fun _ -> arguments cxt f
893
- [E. str name; E. array mutable_flag el])
894
- | Blk_constructor (name ,number ) when is_debug ->
895
- dbg_variant f ;
896
- P. paren_group f 1 (fun _ -> arguments cxt f
897
- [ E. str name; tag ; E. array mutable_flag el])
871
+ if not ! Js_config. debug then begin
872
+ if not (Js_block_runtime. needBlockRuntime tag tag_info) then
873
+ expression_desc cxt level f (Array (el, mutable_flag))
874
+ else
875
+ begin
876
+ pp_block_create f;
877
+ P. paren_group f 1 (fun _ -> arguments cxt f [tag; E. array mutable_flag el])
878
+ end
879
+ end
880
+ else
881
+ if not (Js_block_runtime. needChromeRuntime tag tag_info) then
882
+ expression_desc cxt level f (Array (el, mutable_flag))
883
+ else
884
+ (
885
+ match tag_info with
886
+ | Blk_record labels ->
887
+ dbg_record f ;
888
+ P. paren_group f 1 (fun _ -> arguments cxt f
889
+ [E. array Immutable
890
+ (Ext_array. to_list_f E. str labels);
891
+ E. array mutable_flag
892
+ (Ext_list. map el drop_comment) ]
893
+ )
894
+ | Blk_module (Some labels ) ->
895
+ dbg_local_module f;
896
+ P. paren_group f 1 (fun _ -> arguments cxt f
897
+ [E. array Immutable
898
+ (Ext_list. map labels E. str);
899
+ E. array mutable_flag
900
+ (Ext_list. map el drop_comment)])
901
+ | Blk_variant name ->
902
+ dbg_poly_var f;
903
+ P. paren_group f 1 (fun _ -> arguments cxt f [
904
+ E. str name;
905
+ E. array mutable_flag el])
906
+ | Blk_constructor (name,number)
907
+
908
+ -> (* has to be debug mode *)
909
+ (if number = 1 && Js_block_runtime. tag_is_zero tag then
910
+ dbg_simple_variant f
911
+ else dbg_variant f) ;
912
+ P. paren_group f 1 (fun _ -> arguments cxt f
913
+ [E. str name; E. array mutable_flag el])
898
914
#if OCAML_VERSION =~ " >4.03.0" then
899
- | Blk_record_inlined _ (* TODO: No support for debug mode yet *)
915
+ | Blk_record_inlined _ (* TODO: No support for debug mode yet *)
900
916
#end
901
- | Blk_constructor _
902
- | Blk_tuple
903
- | Blk_array
917
+ | Blk_tuple
918
+ | Blk_array
904
919
#if OCAML_VERSION =~ " >4.03.0" then
905
- | Blk_record_ext _
920
+ | Blk_record_ext _
906
921
#end
907
- | Blk_extension_slot
908
- | Blk_na
909
- | Blk_module None ->
910
- pp_block_create f;
911
- P. paren_group f 1 (fun _ -> arguments cxt f [tag; E. array mutable_flag el])
912
-
922
+ | Blk_extension_slot
923
+ | Blk_na
924
+ | Blk_module None ->
925
+ dbg_block_create f;
926
+ P. paren_group f 1 (fun _ -> arguments cxt f [tag; E. array mutable_flag el])
913
927
)
914
928
915
929
| Caml_block_tag e ->
0 commit comments