@@ -46,19 +46,28 @@ let source_map_enabled = function
46
46
| No_sourcemap -> false
47
47
| Inline | File _ -> true
48
48
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 =
50
57
let f chan k =
51
58
let fmt = Pretty_print. to_out_channel chan in
52
59
Driver. configure fmt;
53
60
if standalone then header ~custom_header fmt;
54
61
if Config.Flag. header () then jsoo_header fmt build_info;
55
62
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));
62
71
match source_map, sm with
63
72
| No_sourcemap , _ | _ , None -> ()
64
73
| ((Inline | File _ ) as output ), Some sm ->
@@ -164,6 +173,7 @@ let run
164
173
; keep_unit_names
165
174
; include_runtime
166
175
; shape_files
176
+ ; shapes = write_shapes
167
177
} =
168
178
let source_map_base = Option. map ~f: snd source_map in
169
179
let source_map =
@@ -378,6 +388,7 @@ let run
378
388
}
379
389
in
380
390
output_gen
391
+ ~write_shapes
381
392
~standalone: true
382
393
~custom_header
383
394
~build_info: (Build_info. create `Runtime )
@@ -426,6 +437,7 @@ let run
426
437
in
427
438
if times () then Format. eprintf " parsing: %a@." Timer. print t1;
428
439
output_gen
440
+ ~write_shapes
429
441
~standalone: true
430
442
~custom_header
431
443
~build_info: (Build_info. create `Exe )
@@ -464,6 +476,7 @@ let run
464
476
in
465
477
if times () then Format. eprintf " parsing: %a@." Timer. print t1;
466
478
output_gen
479
+ ~write_shapes
467
480
~standalone: false
468
481
~custom_header
469
482
~build_info: (Build_info. create `Cmo )
@@ -494,6 +507,7 @@ let run
494
507
failwith " use [-o dirname/] or remove [--keep-unit-names]"
495
508
in
496
509
output_gen
510
+ ~write_shapes
497
511
~standalone: false
498
512
~custom_header
499
513
~build_info: (Build_info. create `Runtime )
@@ -530,6 +544,7 @@ let run
530
544
t1
531
545
(Ocaml_compiler.Cmo_format. name cmo);
532
546
output_gen
547
+ ~write_shapes
533
548
~standalone: false
534
549
~custom_header
535
550
~build_info: (Build_info. create `Cma )
@@ -579,6 +594,7 @@ let run
579
594
, shapes )
580
595
in
581
596
output_gen
597
+ ~write_shapes
582
598
~standalone: false
583
599
~custom_header
584
600
~build_info: (Build_info. create `Cma )
0 commit comments