// rasm-core/src/analysis/err.rs
use crate::analysis::{air::AIRError, ast_analysis::err::ASTAnalyseError};
use std::fmt::Display;

#[derive(Debug)]
pub enum AnalyseErrorKind {
    ASTAnalyse(ASTAnalyseError),
    AIRAnalyse(AIRError),
}

impl Display for AnalyseErrorKind {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::ASTAnalyse(err) => write!(f, "{err}"),
            Self::AIRAnalyse(err) => write!(f, "{err}"),
        }
    }
}

#[derive(Debug)]
pub struct AnalyseError {
    pub kind: AnalyseErrorKind,
}

impl Display for AnalyseError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.kind)
    }
}
