aboutsummaryrefslogtreecommitdiff
path: root/printing/pputils.ml
diff options
context:
space:
mode:
Diffstat (limited to 'printing/pputils.ml')
-rw-r--r--printing/pputils.ml6
1 files changed, 5 insertions, 1 deletions
diff --git a/printing/pputils.ml b/printing/pputils.ml
index 33382fe838..4916889139 100644
--- a/printing/pputils.ml
+++ b/printing/pputils.ml
@@ -17,7 +17,11 @@ open Genredexpr
let pr_located pr (loc, x) =
if Flags.do_beautify () && loc <> Loc.ghost then
let (b, e) = Loc.unloc loc in
- Pp.comment b ++ pr x ++ Pp.comment e
+ (* Side-effect: order matters *)
+ let before = Pp.comment (CLexer.extract_comments b) in
+ let x = pr x in
+ let after = Pp.comment (CLexer.extract_comments e) in
+ before ++ x ++ after
else pr x
let pr_or_var pr = function