use thiserror::Error;
#[derive(Error, Debug)]
pub enum CompileError {
#[error("Encountered unsupported type `{0}`")]
UnsupportedType(String),
#[error("Encountered unsupported operation `{0}`")]
UnsupportedOp(String),
}
pub type Result<T> = core::result::Result<T, CompileError>;
#[derive(Default)]
pub struct EmissionErrors(core::cell::RefCell<Vec<CompileError>>);
impl EmissionErrors {
pub fn record(&self, error: CompileError) {
self.0.borrow_mut().push(error);
}
pub fn take(&self) -> Vec<CompileError> {
core::mem::take(&mut self.0.borrow_mut())
}
}