Start messing around with cranelift.
This commit is contained in:
@@ -21,6 +21,9 @@ pub enum Error {
|
||||
|
||||
#[error("Unbound variable '{0}'")]
|
||||
UnboundVariable(Location, String),
|
||||
|
||||
#[error("Internal error: {0}")]
|
||||
InternalError(Location, String),
|
||||
}
|
||||
|
||||
fn locations_to_labels(start: &Location, end: &Location) -> Vec<Label<usize>> {
|
||||
@@ -168,6 +171,17 @@ impl From<Error> for Diagnostic<usize> {
|
||||
])
|
||||
.with_message(format!("Unbound variable '{}'", name)),
|
||||
},
|
||||
|
||||
Error::InternalError(location, string) => match location {
|
||||
Location::Manufactured => {
|
||||
Diagnostic::error().with_message(format!("Internal error: {}", string))
|
||||
}
|
||||
Location::InFile(file_id, offset) => Diagnostic::error()
|
||||
.with_labels(vec![
|
||||
Label::primary(*file_id, *offset..*offset).with_message("this is related")
|
||||
])
|
||||
.with_message(format!("Internal error: {}", string)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user