diff options
author | Nadrieril | 2024-06-18 11:31:45 +0200 |
---|---|---|
committer | Nadrieril | 2024-06-18 12:11:23 +0200 |
commit | aa5948d7f9fd9b2d0ce18657215dae6877ebd996 (patch) | |
tree | 56008c815bfc43c3c63ef31489a853241983d87d /compiler | |
parent | 43a9fb0fa5a1c03a7cce575a052f0d4201189d1d (diff) |
Tiny dedup
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/Errors.ml | 5 | ||||
-rw-r--r-- | compiler/ExtractTypes.ml | 11 |
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, _ -> [] |