Skip to content

Commit 2ac7a96

Browse files
committed
[compiler] add option to hide location when dumping
1 parent 1a96248 commit 2ac7a96

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

parsing/printast.ml

+2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ let fmt_position with_name f l =
2828
;;
2929

3030
let fmt_location f loc =
31+
if !Clflags.dump_location then (
3132
let p_2nd_name = loc.loc_start.pos_fname <> loc.loc_end.pos_fname in
3233
fprintf f "(%a..%a)" (fmt_position true) loc.loc_start
3334
(fmt_position p_2nd_name) loc.loc_end;
3435
if loc.loc_ghost then fprintf f " ghost";
36+
)
3537
;;
3638

3739
let rec fmt_longident_aux f x =

typing/printtyped.ml

+2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ let fmt_position f l =
2727
;;
2828

2929
let fmt_location f loc =
30+
if !Clflags.dump_location then (
3031
fprintf f "(%a..%a)" fmt_position loc.loc_start fmt_position loc.loc_end;
3132
if loc.loc_ghost then fprintf f " ghost";
33+
)
3234
;;
3335

3436
let rec fmt_longident_aux f x =

utils/clflags.ml

+1
Original file line numberDiff line numberDiff line change
@@ -419,4 +419,5 @@ let bs_only = ref false
419419
let bs_gentype = ref None
420420
let no_assert_false = ref false
421421
let bs_quiet = ref false
422+
let dump_location = ref true
422423
#end

utils/clflags.mli

+1
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,5 @@ val bs_only : bool ref (* set true on bs top*)
243243
val bs_gentype : string option ref
244244
val no_assert_false : bool ref
245245
val bs_quiet : bool ref
246+
val dump_location : bool ref
246247
#end

0 commit comments

Comments
 (0)