@@ -46,19 +46,28 @@ let source_map_enabled = function
4646 | No_sourcemap -> false
4747 | Inline | File _ -> true
4848
49- let output_gen ~standalone ~custom_header ~build_info ~source_map output_file f =
49+ let output_gen
50+ ~write_shapes
51+ ~standalone
52+ ~custom_header
53+ ~build_info
54+ ~source_map
55+ output_file
56+ f =
5057 let f chan k =
5158 let fmt = Pretty_print. to_out_channel chan in
5259 Driver. configure fmt;
5360 if standalone then header ~custom_header fmt;
5461 if Config.Flag. header () then jsoo_header fmt build_info;
5562 let sm, shapes = f ~standalone ~source_map (k, fmt) in
56- (match output_file with
57- | `Stdout -> ()
58- | `Name name ->
59- Shape.Store. save'
60- (Filename. remove_extension name ^ Shape.Store. ext)
61- (StringMap. bindings shapes));
63+ (if write_shapes
64+ then
65+ match output_file with
66+ | `Stdout -> ()
67+ | `Name name ->
68+ Shape.Store. save'
69+ (Filename. remove_extension name ^ Shape.Store. ext)
70+ (StringMap. bindings shapes));
6271 match source_map, sm with
6372 | No_sourcemap , _ | _ , None -> ()
6473 | ((Inline | File _ ) as output ), Some sm ->
@@ -164,6 +173,7 @@ let run
164173 ; keep_unit_names
165174 ; include_runtime
166175 ; shape_files
176+ ; shapes = write_shapes
167177 } =
168178 let source_map_base = Option. map ~f: snd source_map in
169179 let source_map =
@@ -378,6 +388,7 @@ let run
378388 }
379389 in
380390 output_gen
391+ ~write_shapes
381392 ~standalone: true
382393 ~custom_header
383394 ~build_info: (Build_info. create `Runtime )
@@ -426,6 +437,7 @@ let run
426437 in
427438 if times () then Format. eprintf " parsing: %a@." Timer. print t1;
428439 output_gen
440+ ~write_shapes
429441 ~standalone: true
430442 ~custom_header
431443 ~build_info: (Build_info. create `Exe )
@@ -464,6 +476,7 @@ let run
464476 in
465477 if times () then Format. eprintf " parsing: %a@." Timer. print t1;
466478 output_gen
479+ ~write_shapes
467480 ~standalone: false
468481 ~custom_header
469482 ~build_info: (Build_info. create `Cmo )
@@ -494,6 +507,7 @@ let run
494507 failwith " use [-o dirname/] or remove [--keep-unit-names]"
495508 in
496509 output_gen
510+ ~write_shapes
497511 ~standalone: false
498512 ~custom_header
499513 ~build_info: (Build_info. create `Runtime )
@@ -530,6 +544,7 @@ let run
530544 t1
531545 (Ocaml_compiler.Cmo_format. name cmo);
532546 output_gen
547+ ~write_shapes
533548 ~standalone: false
534549 ~custom_header
535550 ~build_info: (Build_info. create `Cma )
@@ -579,6 +594,7 @@ let run
579594 , shapes )
580595 in
581596 output_gen
597+ ~write_shapes
582598 ~standalone: false
583599 ~custom_header
584600 ~build_info: (Build_info. create `Cma )
0 commit comments