mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Make SubMessage::msg, hint
public members
This commit is contained in:
parent
428a557313
commit
aa3bf7f44c
2 changed files with 10 additions and 6 deletions
|
@ -392,8 +392,8 @@ fn format_context<E: ErrorDisplay + ?Sized>(
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct SubMessage {
|
pub struct SubMessage {
|
||||||
pub loc: Location,
|
pub loc: Location,
|
||||||
msg: Vec<String>,
|
pub msg: Vec<String>,
|
||||||
hint: Option<String>,
|
pub hint: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SubMessage {
|
impl SubMessage {
|
||||||
|
@ -459,8 +459,12 @@ impl SubMessage {
|
||||||
self.hint = Some(hint.into());
|
self.hint = Some(hint.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_hint(self) -> Option<String> {
|
pub fn get_hint(&self) -> Option<&str> {
|
||||||
self.hint
|
self.hint.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_msg(&self) -> &[String] {
|
||||||
|
self.msg.as_ref()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line breaks are not included except for line breaks that signify the end of a sentence.
|
// Line breaks are not included except for line breaks that signify the end of a sentence.
|
||||||
|
|
|
@ -838,7 +838,7 @@ impl Context {
|
||||||
// HACK: dname.loc()はダミーLocationしか返さないので、エラーならop.loc()で上書きする
|
// HACK: dname.loc()はダミーLocationしか返さないので、エラーならop.loc()で上書きする
|
||||||
bin.loc(),
|
bin.loc(),
|
||||||
vec![],
|
vec![],
|
||||||
sub_msg.get_hint(),
|
sub_msg.hint,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let core = ErrorCore::new(
|
let core = ErrorCore::new(
|
||||||
|
@ -886,7 +886,7 @@ impl Context {
|
||||||
sub_msges.push(SubMessage::ambiguous_new(
|
sub_msges.push(SubMessage::ambiguous_new(
|
||||||
unary.loc(),
|
unary.loc(),
|
||||||
vec![],
|
vec![],
|
||||||
sub_msg.get_hint(),
|
sub_msg.hint,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let core = ErrorCore::new(
|
let core = ErrorCore::new(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue