1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::BlockRef;
use thiserror::Error;

pub trait Validate {
    fn validate(&self) -> Result<(), ValidateErr>;
}

pub trait OpValidator {
    fn validate_op(&self) -> Result<(), ValidateErr>;
}

#[derive(Debug, Error)]
pub enum ValidateErr {
    #[error("Region contains no block with name '{0}'")]
    BlockNotRegisteredWithRegion(String),
    #[error("The last operation in basic block must be a terminator")]
    BlockMissingTerminator(BlockRef),
}