Skip to content

Commit c50e1f4

Browse files
committed
more inspection in cmjdump.exe
1 parent fa1e0b9 commit c50e1f4

File tree

7 files changed

+144
-23
lines changed

7 files changed

+144
-23
lines changed

jscomp/all.depend

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ core/js_main.cmx : super_errors/super_main.cmx core/ocaml_parse.cmx \
637637
core/js_implementation.cmx common/js_config.cmx ext/ext_string.cmx \
638638
core/bs_conditional_initial.cmx core/js_main.cmi
639639
core/cmjdump_main.cmx : ext/string_map.cmx core/lam_arity.cmx \
640-
core/js_cmj_format.cmx
640+
common/js_config.cmx core/js_cmj_format.cmx
641641
core/astdump_main.cmx : common/ml_binary.cmx bsb/bsb_depfile_gen.cmx
642642
ounit/oUnit.cmi :
643643
ounit/oUnitDiff.cmi :

jscomp/bin/bsdep.ml

+30-1
Original file line numberDiff line numberDiff line change
@@ -25921,7 +25921,8 @@ type packages_info =
2592125921
| Empty
2592225922
| NonBrowser of (package_name * package_info list)
2592325923

25924-
25924+
val dump_packages_info :
25925+
Format.formatter -> packages_info -> unit
2592525926

2592625927
val cmj_ext : string
2592725928

@@ -26099,7 +26100,35 @@ type packages_info =
2609926100
| NonBrowser of (package_name * package_info list)
2610026101
(** we don't force people to use package *)
2610126102

26103+
let dump_package_info
26104+
(fmt : Format.formatter)
26105+
((ms, name) : package_info)
26106+
=
26107+
Format.fprintf
26108+
fmt
26109+
"@[%s:@ %s@]"
26110+
(match ms with
26111+
| NodeJS -> "NodeJS"
26112+
| AmdJS -> "AmdJS"
26113+
| Goog -> "Goog"
26114+
| Es6 -> "Es6"
26115+
| Es6_global -> "Es6_global"
26116+
| AmdJS_global -> "AmdJS_globl"
26117+
) name
2610226118

26119+
26120+
let dump_packages_info
26121+
(fmt : Format.formatter)
26122+
(p : packages_info) =
26123+
match p with
26124+
| Empty -> Format.pp_print_string fmt "<Empty>"
26125+
| NonBrowser (name, ls) ->
26126+
Format.fprintf fmt "@[%s;@ @[%a@]@]"
26127+
name
26128+
(Format.pp_print_list
26129+
~pp_sep:(fun fmt () -> Format.pp_print_space fmt ())
26130+
dump_package_info
26131+
) ls
2610326132

2610426133
let cmj_ext = ".cmj"
2610526134

jscomp/bin/bsppx.ml

+30-1
Original file line numberDiff line numberDiff line change
@@ -7869,7 +7869,8 @@ type packages_info =
78697869
| Empty
78707870
| NonBrowser of (package_name * package_info list)
78717871

7872-
7872+
val dump_packages_info :
7873+
Format.formatter -> packages_info -> unit
78737874

78747875
val cmj_ext : string
78757876

@@ -8047,7 +8048,35 @@ type packages_info =
80478048
| NonBrowser of (package_name * package_info list)
80488049
(** we don't force people to use package *)
80498050

8051+
let dump_package_info
8052+
(fmt : Format.formatter)
8053+
((ms, name) : package_info)
8054+
=
8055+
Format.fprintf
8056+
fmt
8057+
"@[%s:@ %s@]"
8058+
(match ms with
8059+
| NodeJS -> "NodeJS"
8060+
| AmdJS -> "AmdJS"
8061+
| Goog -> "Goog"
8062+
| Es6 -> "Es6"
8063+
| Es6_global -> "Es6_global"
8064+
| AmdJS_global -> "AmdJS_globl"
8065+
) name
80508066

8067+
8068+
let dump_packages_info
8069+
(fmt : Format.formatter)
8070+
(p : packages_info) =
8071+
match p with
8072+
| Empty -> Format.pp_print_string fmt "<Empty>"
8073+
| NonBrowser (name, ls) ->
8074+
Format.fprintf fmt "@[%s;@ @[%a@]@]"
8075+
name
8076+
(Format.pp_print_list
8077+
~pp_sep:(fun fmt () -> Format.pp_print_space fmt ())
8078+
dump_package_info
8079+
) ls
80518080

80528081
let cmj_ext = ".cmj"
80538082

jscomp/bin/whole_compiler.ml

+30-1
Original file line numberDiff line numberDiff line change
@@ -22386,7 +22386,8 @@ type packages_info =
2238622386
| Empty
2238722387
| NonBrowser of (package_name * package_info list)
2238822388

22389-
22389+
val dump_packages_info :
22390+
Format.formatter -> packages_info -> unit
2239022391

2239122392
val cmj_ext : string
2239222393

@@ -22564,7 +22565,35 @@ type packages_info =
2256422565
| NonBrowser of (package_name * package_info list)
2256522566
(** we don't force people to use package *)
2256622567

22568+
let dump_package_info
22569+
(fmt : Format.formatter)
22570+
((ms, name) : package_info)
22571+
=
22572+
Format.fprintf
22573+
fmt
22574+
"@[%s:@ %s@]"
22575+
(match ms with
22576+
| NodeJS -> "NodeJS"
22577+
| AmdJS -> "AmdJS"
22578+
| Goog -> "Goog"
22579+
| Es6 -> "Es6"
22580+
| Es6_global -> "Es6_global"
22581+
| AmdJS_global -> "AmdJS_globl"
22582+
) name
2256722583

22584+
22585+
let dump_packages_info
22586+
(fmt : Format.formatter)
22587+
(p : packages_info) =
22588+
match p with
22589+
| Empty -> Format.pp_print_string fmt "<Empty>"
22590+
| NonBrowser (name, ls) ->
22591+
Format.fprintf fmt "@[%s;@ @[%a@]@]"
22592+
name
22593+
(Format.pp_print_list
22594+
~pp_sep:(fun fmt () -> Format.pp_print_space fmt ())
22595+
dump_package_info
22596+
) ls
2256822597

2256922598
let cmj_ext = ".cmj"
2257022599

jscomp/common/js_config.ml

+29-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,35 @@ type packages_info =
4242
| NonBrowser of (package_name * package_info list)
4343
(** we don't force people to use package *)
4444

45-
45+
let dump_package_info
46+
(fmt : Format.formatter)
47+
((ms, name) : package_info)
48+
=
49+
Format.fprintf
50+
fmt
51+
"@[%s:@ %s@]"
52+
(match ms with
53+
| NodeJS -> "NodeJS"
54+
| AmdJS -> "AmdJS"
55+
| Goog -> "Goog"
56+
| Es6 -> "Es6"
57+
| Es6_global -> "Es6_global"
58+
| AmdJS_global -> "AmdJS_globl"
59+
) name
60+
61+
62+
let dump_packages_info
63+
(fmt : Format.formatter)
64+
(p : packages_info) =
65+
match p with
66+
| Empty -> Format.pp_print_string fmt "<Empty>"
67+
| NonBrowser (name, ls) ->
68+
Format.fprintf fmt "@[%s;@ @[%a@]@]"
69+
name
70+
(Format.pp_print_list
71+
~pp_sep:(fun fmt () -> Format.pp_print_space fmt ())
72+
dump_package_info
73+
) ls
4674

4775
let cmj_ext = ".cmj"
4876

jscomp/common/js_config.mli

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ type packages_info =
3939
| Empty
4040
| NonBrowser of (package_name * package_info list)
4141

42-
42+
val dump_packages_info :
43+
Format.formatter -> packages_info -> unit
4344

4445
val cmj_ext : string
4546

jscomp/core/cmjdump_main.ml

+22-17
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,30 @@
2424

2525
let p = Format.fprintf
2626

27-
let pp_cmj fmt ({ values ; effect; } :Js_cmj_format.t) =
27+
let pp_cmj fmt
28+
({ values ; effect; npm_package_path } :Js_cmj_format.t) =
29+
p fmt "@[package info: %a@]@."
30+
Js_config.dump_packages_info
31+
npm_package_path
32+
;
2833
p fmt "@[effect: %a@]@."
29-
(fun fmt o ->
30-
match o with None -> ()
31-
| Some s -> p fmt "None pure due to %s" s
32-
) effect ;
33-
p fmt "@[%a@]@."
34-
(fun fmt m ->
35-
m |> String_map.iter (fun k (v : Js_cmj_format.cmj_value) ->
36-
match v.arity with
37-
| Single arity ->
38-
p fmt "@[%s:@ @[%a@]@]@." k Lam_arity.print arity
39-
| Submodule xs ->
40-
p fmt "@[<h 1>@[%s:@ @[<hov 2>%a@]@]@]" k
41-
(fun fmt xs ->
42-
Array.iter (fun arity -> p fmt "@[%a@]@ ;" Lam_arity.print arity )
43-
xs) xs
34+
(fun fmt o ->
35+
match o with None -> ()
36+
| Some s -> p fmt "None pure due to %s" s
37+
) effect ;
38+
p fmt "@[arities: @[%a@]@]@."
39+
(fun fmt m ->
40+
m |> String_map.iter (fun k (v : Js_cmj_format.cmj_value) ->
41+
match v.arity with
42+
| Single arity ->
43+
p fmt "@[%s:@ @[%a@]@]@." k Lam_arity.print arity
44+
| Submodule xs ->
45+
p fmt "@[<h 1>@[%s:@ @[<hov 2>%a@]@]@]" k
46+
(fun fmt xs ->
47+
Array.iter (fun arity -> p fmt "@[%a@]@ ;" Lam_arity.print arity )
48+
xs) xs
4449

45-
)) values
50+
)) values
4651

4752

4853

0 commit comments

Comments
 (0)