mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-15 00:55:05 +01:00
40 lines
703 B
Rust
40 lines
703 B
Rust
#![allow(dead_code)] // TODO: no
|
|
#![warn(rust_2018_idioms)]
|
|
|
|
mod ir;
|
|
mod lower;
|
|
mod ty;
|
|
|
|
pub use lower::lower_translation_unit;
|
|
use parser::Span;
|
|
|
|
#[derive(Debug)]
|
|
pub struct Error {
|
|
msg: String,
|
|
span: Span,
|
|
notes: Vec<Note>,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
struct Note {
|
|
msg: String,
|
|
span: Option<Span>,
|
|
}
|
|
|
|
impl Error {
|
|
pub fn new(msg: impl Into<String>, span: Span) -> Self {
|
|
Self {
|
|
msg: msg.into(),
|
|
span,
|
|
notes: Vec::new(),
|
|
}
|
|
}
|
|
|
|
pub fn note_spanned(mut self, msg: impl Into<String>, span: Span) -> Self {
|
|
self.notes.push(Note {
|
|
msg: msg.into(),
|
|
span: Some(span),
|
|
});
|
|
self
|
|
}
|
|
}
|