standalone: Improve error output format

David Mak 2023-11-06 15:18:50 +08:00
parent dacef0b7a4
commit 9a2249fd74
3 changed files with 9 additions and 1 deletions

1
Cargo.lock generated
View File

@ -705,6 +705,7 @@ version = "0.1.0"
dependencies = [
"clap",
"inkwell",
"itertools 0.11.0",
"nac3core",
"nac3parser",
"parking_lot",

View File

@ -5,6 +5,7 @@ authors = ["M-Labs"]
edition = "2021"
[dependencies]
itertools = "0.11"
parking_lot = "0.12"
nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" }

View File

@ -6,6 +6,7 @@ use inkwell::{
targets::*,
OptimizationLevel,
};
use itertools::Itertools;
use parking_lot::{Mutex, RwLock};
use std::{borrow::Borrow, collections::HashMap, fs, path::Path, sync::Arc};
@ -296,7 +297,12 @@ fn main() {
let signature = store.from_signature(&mut composer.unifier, &primitive, &signature, &mut cache);
let signature = store.add_cty(signature);
composer.start_analysis(true).unwrap();
if let Err(errs) = composer.start_analysis(true) {
panic!(
"compilation failed\n----------\n{}",
errs.into_iter().sorted().join("\n----------\n")
);
}
let top_level = Arc::new(composer.make_top_level_context());