diff options
author | Son Ho | 2024-04-11 19:40:08 +0200 |
---|---|---|
committer | Son Ho | 2024-04-11 19:40:08 +0200 |
commit | 86c3680b1f3f50b4c4e6198eebc145cadfff3876 (patch) | |
tree | c79ea2c4a35198d9011287db4767599b0c5c1c42 /compiler/Main.ml | |
parent | 9c1773530a7056c161e69471b36eaa3603f6ed26 (diff) | |
parent | 4fb9c9f655a9ffc3b4a1a717988311c057c9c599 (diff) |
Merge remote-tracking branch 'origin/main' into son/clean
Diffstat (limited to 'compiler/Main.ml')
-rw-r--r-- | compiler/Main.ml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/Main.ml b/compiler/Main.ml index db200f37..6161f2f2 100644 --- a/compiler/Main.ml +++ b/compiler/Main.ml @@ -274,12 +274,19 @@ let () = (* Translate the functions *) Aeneas.Translate.translate_crate filename dest_dir m - with Errors.CFailure (meta, msg) -> + with Errors.CFailure (_, _) -> (* In theory it shouldn't happen, but there may be uncaught errors - note that we let the [Failure] exceptions go through (they are send if we use the option [-abort-on-error] *) - log#serror (Errors.format_error_message meta msg); - exit 1); + ()); + + if !Errors.error_list <> [] then ( + List.iter + (fun (meta, msg) -> log#serror (Errors.format_error_message meta msg)) + (* Reverse the list of error messages so that we print them from the + earliest to the latest. *) + (List.rev !Errors.error_list); + exit 1); (* Print total elapsed time *) log#linfo |