Rename ParseSess::span_diagnostic
as ParseSess::dcx
.
This commit is contained in:
parent
c7992aff25
commit
7738d69007
@ -67,7 +67,7 @@ fn parse_cfg_if_inner<'a>(
|
|||||||
Ok(None) => continue,
|
Ok(None) => continue,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.cancel();
|
err.cancel();
|
||||||
parser.sess.span_diagnostic.reset_err_count();
|
parser.sess.dcx.reset_err_count();
|
||||||
return Err(
|
return Err(
|
||||||
"Expected item inside cfg_if block, but failed to parse it as an item",
|
"Expected item inside cfg_if block, but failed to parse it as an item",
|
||||||
);
|
);
|
||||||
|
@ -16,8 +16,8 @@ macro_rules! parse_or {
|
|||||||
($method:ident $(,)* $($arg:expr),* $(,)*) => {
|
($method:ident $(,)* $($arg:expr),* $(,)*) => {
|
||||||
match parser.$method($($arg,)*) {
|
match parser.$method($($arg,)*) {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
if parser.sess.span_diagnostic.has_errors().is_some() {
|
if parser.sess.dcx.has_errors().is_some() {
|
||||||
parser.sess.span_diagnostic.reset_err_count();
|
parser.sess.dcx.reset_err_count();
|
||||||
return None;
|
return None;
|
||||||
} else {
|
} else {
|
||||||
val
|
val
|
||||||
@ -25,7 +25,7 @@ macro_rules! parse_or {
|
|||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
err.cancel();
|
err.cancel();
|
||||||
parser.sess.span_diagnostic.reset_err_count();
|
parser.sess.dcx.reset_err_count();
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@ macro_rules! parse_macro_arg {
|
|||||||
let mut cloned_parser = (*parser).clone();
|
let mut cloned_parser = (*parser).clone();
|
||||||
match $parser(&mut cloned_parser) {
|
match $parser(&mut cloned_parser) {
|
||||||
Ok(x) => {
|
Ok(x) => {
|
||||||
if parser.sess.span_diagnostic.has_errors().is_some() {
|
if parser.sess.dcx.has_errors().is_some() {
|
||||||
parser.sess.span_diagnostic.reset_err_count();
|
parser.sess.dcx.reset_err_count();
|
||||||
} else {
|
} else {
|
||||||
// Parsing succeeded.
|
// Parsing succeeded.
|
||||||
*parser = cloned_parser;
|
*parser = cloned_parser;
|
||||||
@ -38,7 +38,7 @@ macro_rules! parse_macro_arg {
|
|||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
e.cancel();
|
e.cancel();
|
||||||
parser.sess.span_diagnostic.reset_err_count();
|
parser.sess.dcx.reset_err_count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -218,7 +218,7 @@ pub(crate) fn ignore_file(&self, path: &FileName) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn set_silent_emitter(&mut self) {
|
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 {
|
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 {
|
impl ParseSess {
|
||||||
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
|
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
|
||||||
for diagnostic in diagnostics {
|
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 {
|
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) {
|
pub(super) fn reset_errors(&self) {
|
||||||
self.parse_sess.span_diagnostic.reset_err_count();
|
self.parse_sess.dcx.reset_err_count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user