use std::path::PathBuf;
use bynk_syntax::error::CompileError;
pub struct AttributedError {
pub source_path: Option<PathBuf>,
pub error: CompileError,
pub label_files: Vec<LabelFile>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum LabelFile {
Primary,
Other(PathBuf),
FirstParty {
identity_path: &'static str,
source: &'static str,
},
Unavailable,
}
impl AttributedError {
pub fn new(source_path: Option<PathBuf>, error: CompileError) -> Self {
Self {
source_path,
error,
label_files: Vec::new(),
}
}
pub fn label_file(&self, index: usize) -> &LabelFile {
self.label_files.get(index).unwrap_or(&LabelFile::Primary)
}
}