summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/Errors.ml5
-rw-r--r--compiler/ExtractTypes.ml11
2 files changed, 4 insertions, 12 deletions
diff --git a/compiler/Errors.ml b/compiler/Errors.ml
index 6e2de7e1..838e1e37 100644
--- a/compiler/Errors.ml
+++ b/compiler/Errors.ml
@@ -1,7 +1,6 @@
let log = Logging.errors_log
-let span_to_string (span : Meta.span) =
- let raw_span = span.span in
+let raw_span_to_string (raw_span : Meta.raw_span) =
let file = match raw_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
@@ -11,6 +10,8 @@ let span_to_string (span : Meta.span) =
^ "-"
^ loc_to_string raw_span.end_loc
+let span_to_string (span : Meta.span) = raw_span_to_string span.span
+
let format_error_message (span : Meta.span option) (msg : string) =
let span =
match span with None -> "" | Some span -> "\n" ^ span_to_string span
diff --git a/compiler/ExtractTypes.ml b/compiler/ExtractTypes.ml
index 631db13e..edd9d58e 100644
--- a/compiler/ExtractTypes.ml
+++ b/compiler/ExtractTypes.ml
@@ -1162,16 +1162,7 @@ let extract_comment_with_raw_span (ctx : extraction_ctx) (fmt : F.formatter)
(sl : string list) (name : Types.name option)
?(generics : (Types.generic_params * Types.generic_args) option = None)
(raw_span : Meta.raw_span) : unit =
- let file = match raw_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 raw_span =
- "Source: '" ^ file ^ "', lines "
- ^ loc_to_string raw_span.beg_loc
- ^ "-"
- ^ loc_to_string raw_span.end_loc
- in
+ let raw_span = raw_span_to_string raw_span in
let name =
match (name, generics) with
| None, _ -> []