Add: Location moved to ErrorCore

This commit is contained in:
GreasySlug 2022-11-18 12:31:44 +09:00
parent 000124fea8
commit 4ae81aa05e
6 changed files with 80 additions and 6 deletions

View file

@ -501,6 +501,7 @@ pub struct ErrorCore {
pub main_message: AtomicStr,
pub errno: usize,
pub kind: ErrorKind,
pub loc: Location,
theme: Theme,
}
@ -510,26 +511,25 @@ impl ErrorCore {
main_message: S,
errno: usize,
kind: ErrorKind,
loc: Location,
) -> Self {
Self {
sub_messages,
main_message: main_message.into(),
errno,
kind,
loc,
theme: THEME,
}
}
pub fn sub_messages(&self) -> &Vec<SubMessage> {
&self.sub_messages
}
pub fn dummy(errno: usize) -> Self {
Self::new(
vec![SubMessage::only_loc(Location::Line(errno as usize))],
"<dummy>",
errno,
DummyError,
Location::Line(errno as usize),
)
}
@ -555,6 +555,7 @@ impl ErrorCore {
&m_msg,
errno,
CompilerSystemError,
loc,
)
}