Rename ParseSess::span_diagnostic as ParseSess::dcx.

This commit is contained in:
Nicholas Nethercote 2023-12-17 22:25:47 +11:00
parent c7992aff25
commit 7738d69007
4 changed files with 11 additions and 11 deletions

View File

@ -67,7 +67,7 @@ fn parse_cfg_if_inner<'a>(
Ok(None) => continue,
Err(err) => {
err.cancel();
parser.sess.span_diagnostic.reset_err_count();
parser.sess.dcx.reset_err_count();
return Err(
"Expected item inside cfg_if block, but failed to parse it as an item",
);

View File

@ -16,8 +16,8 @@ macro_rules! parse_or {
($method:ident $(,)* $($arg:expr),* $(,)*) => {
match parser.$method($($arg,)*) {
Ok(val) => {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
if parser.sess.dcx.has_errors().is_some() {
parser.sess.dcx.reset_err_count();
return None;
} else {
val
@ -25,7 +25,7 @@ macro_rules! parse_or {
}
Err(err) => {
err.cancel();
parser.sess.span_diagnostic.reset_err_count();
parser.sess.dcx.reset_err_count();
return None;
}
}

View File

@ -28,8 +28,8 @@ macro_rules! parse_macro_arg {
let mut cloned_parser = (*parser).clone();
match $parser(&mut cloned_parser) {
Ok(x) => {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
if parser.sess.dcx.has_errors().is_some() {
parser.sess.dcx.reset_err_count();
} else {
// Parsing succeeded.
*parser = cloned_parser;
@ -38,7 +38,7 @@ macro_rules! parse_macro_arg {
}
Err(e) => {
e.cancel();
parser.sess.span_diagnostic.reset_err_count();
parser.sess.dcx.reset_err_count();
}
}
};

View File

@ -218,7 +218,7 @@ pub(crate) fn ignore_file(&self, path: &FileName) -> bool {
}
pub(crate) fn set_silent_emitter(&mut self) {
self.parse_sess.span_diagnostic = DiagCtxt::with_emitter(silent_emitter());
self.parse_sess.dcx = DiagCtxt::with_emitter(silent_emitter());
}
pub(crate) fn span_to_filename(&self, span: Span) -> FileName {
@ -285,7 +285,7 @@ pub(crate) fn get_original_snippet(&self, file_name: &FileName) -> Option<Lrc<St
impl ParseSess {
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
for diagnostic in diagnostics {
self.parse_sess.span_diagnostic.emit_diagnostic(diagnostic);
self.parse_sess.dcx.emit_diagnostic(diagnostic);
}
}
@ -294,11 +294,11 @@ pub(super) fn can_reset_errors(&self) -> bool {
}
pub(super) fn has_errors(&self) -> bool {
self.parse_sess.span_diagnostic.has_errors().is_some()
self.parse_sess.dcx.has_errors().is_some()
}
pub(super) fn reset_errors(&self) {
self.parse_sess.span_diagnostic.reset_err_count();
self.parse_sess.dcx.reset_err_count();
}
}