slint/sixtyfps_compiler/diagnostics.rs
2020-05-06 16:43:04 +02:00

20 lines
466 B
Rust

#[derive(Default, Debug, Clone, PartialEq, Eq, Hash)]
pub struct CompilerDiagnostic {
pub message: String,
pub offset: usize,
}
#[derive(Default, Debug)]
pub struct Diagnostics {
pub inner: Vec<CompilerDiagnostic>,
}
impl Diagnostics {
pub fn push_error(&mut self, message: String, offset: usize) {
self.inner.push(CompilerDiagnostic { message, offset });
}
pub fn has_error(&self) -> bool {
!self.inner.is_empty()
}
}