Refactor away method LoweringContext::diagnostic
This commit is contained in:
parent
df572fcf4e
commit
417fe6d16e
@ -50,7 +50,6 @@ use std::collections::BTreeMap;
|
||||
use std::iter;
|
||||
use syntax::ast::*;
|
||||
use syntax::attr::{ThinAttributes, ThinAttributesExt};
|
||||
use syntax::errors::Handler;
|
||||
use syntax::ext::mtwt;
|
||||
use syntax::ptr::P;
|
||||
use syntax::codemap::{respan, Spanned, Span};
|
||||
@ -94,7 +93,7 @@ impl Resolver for DummyResolver {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'hir> LoweringContext<'a> {
|
||||
impl<'a> LoweringContext<'a> {
|
||||
pub fn new(id_assigner: &'a NodeIdAssigner,
|
||||
c: Option<&Crate>,
|
||||
resolver: &'a mut Resolver)
|
||||
@ -125,11 +124,6 @@ impl<'a, 'hir> LoweringContext<'a> {
|
||||
hir::Ident::from_name(token::gensym(s))
|
||||
}
|
||||
|
||||
// Panics if this LoweringContext's NodeIdAssigner is not able to emit diagnostics.
|
||||
fn diagnostic(&self) -> &Handler {
|
||||
self.id_assigner.diagnostic()
|
||||
}
|
||||
|
||||
fn with_parent_def<T, F: FnOnce() -> T>(&self, parent_id: NodeId, f: F) -> T {
|
||||
let old_def = self.parent_def.get();
|
||||
self.parent_def.set(match self.resolver.borrow_mut().definitions() {
|
||||
@ -1245,8 +1239,8 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P<hir::Expr> {
|
||||
make_struct(lctx, e, &["RangeInclusive", "NonEmpty"],
|
||||
&[("start", e1), ("end", e2)]),
|
||||
|
||||
_ => panic!(lctx.diagnostic().span_fatal(e.span,
|
||||
"inclusive range with no end"))
|
||||
_ => panic!(lctx.id_assigner.diagnostic()
|
||||
.span_fatal(e.span, "inclusive range with no end")),
|
||||
};
|
||||
}
|
||||
ExprKind::Path(ref qself, ref path) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user