summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2023-11-21 14:56:46 +0100
committerSon Ho2023-11-21 14:56:46 +0100
commitd564a010893653edea0df518e0b740fadf7df031 (patch)
treef706e11a5ae876c2c189ed389d49519ebf23bb18
parent77ba13b371cccbe8098e432ebd287108d5373666 (diff)
Make minor updates to the extraction of spans
Diffstat (limited to '')
-rw-r--r--compiler/ExtractTypes.ml9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/ExtractTypes.ml b/compiler/ExtractTypes.ml
index 4dcefabc..3a81e6fe 100644
--- a/compiler/ExtractTypes.ml
+++ b/compiler/ExtractTypes.ml
@@ -1816,11 +1816,12 @@ let extract_comment (fmt : F.formatter) (sl : string list) : unit =
let extract_comment_with_span (fmt : F.formatter) (sl : string list)
(span : Meta.span) : unit =
let file = match span.file with Virtual s | Local s -> s in
+ let loc_to_string (l : Meta.loc) : string =
+ string_of_int l.line ^ ":" ^ string_of_int l.col
+ in
let span =
- "Source: '" ^ file ^ "': lines "
- ^ string_of_int span.beg_loc.line
- ^ "-"
- ^ string_of_int span.end_loc.line
+ "Source: '" ^ file ^ "', lines " ^ loc_to_string span.beg_loc ^ "-"
+ ^ loc_to_string span.end_loc
in
extract_comment fmt (sl @ [ span ])