Store deprecated status of i/u-suffixed literals.
This commit is contained in:
parent
2f99a41fe1
commit
e95779554e
18 changed files with 112 additions and 79 deletions
|
|
@ -642,10 +642,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
self.expr(sp, ast::ExprLit(P(respan(sp, lit))))
|
||||
}
|
||||
fn expr_uint(&self, span: Span, i: uint) -> P<ast::Expr> {
|
||||
self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
|
||||
self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs(false))))
|
||||
}
|
||||
fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs, ast::Sign::new(i))))
|
||||
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false),
|
||||
ast::Sign::new(i))))
|
||||
}
|
||||
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8)))
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,7 @@ impl<'a> MethodDef<'a> {
|
|||
let arms: Vec<ast::Arm> = variants.iter().enumerate()
|
||||
.map(|(index, variant)| {
|
||||
let pat = variant_to_pat(cx, sp, type_ident, &**variant);
|
||||
let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs));
|
||||
let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs(false)));
|
||||
cx.arm(sp, vec![pat], cx.expr_lit(sp, lit))
|
||||
}).collect();
|
||||
|
||||
|
|
|
|||
|
|
@ -244,10 +244,10 @@ pub mod rt {
|
|||
}
|
||||
|
||||
macro_rules! impl_to_source_int {
|
||||
(signed, $t:ty, $tag:ident) => (
|
||||
(signed, $t:ty, $tag:expr) => (
|
||||
impl ToSource for $t {
|
||||
fn to_source(&self) -> String {
|
||||
let lit = ast::LitInt(*self as u64, ast::SignedIntLit(ast::$tag,
|
||||
let lit = ast::LitInt(*self as u64, ast::SignedIntLit($tag,
|
||||
ast::Sign::new(*self)));
|
||||
pprust::lit_to_string(&dummy_spanned(lit))
|
||||
}
|
||||
|
|
@ -258,10 +258,10 @@ pub mod rt {
|
|||
}
|
||||
}
|
||||
);
|
||||
(unsigned, $t:ty, $tag:ident) => (
|
||||
(unsigned, $t:ty, $tag:expr) => (
|
||||
impl ToSource for $t {
|
||||
fn to_source(&self) -> String {
|
||||
let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit(ast::$tag));
|
||||
let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag));
|
||||
pprust::lit_to_string(&dummy_spanned(lit))
|
||||
}
|
||||
}
|
||||
|
|
@ -273,17 +273,17 @@ pub mod rt {
|
|||
);
|
||||
}
|
||||
|
||||
impl_to_source_int! { signed, int, TyIs }
|
||||
impl_to_source_int! { signed, i8, TyI8 }
|
||||
impl_to_source_int! { signed, i16, TyI16 }
|
||||
impl_to_source_int! { signed, i32, TyI32 }
|
||||
impl_to_source_int! { signed, i64, TyI64 }
|
||||
impl_to_source_int! { signed, int, ast::TyIs(false) }
|
||||
impl_to_source_int! { signed, i8, ast::TyI8 }
|
||||
impl_to_source_int! { signed, i16, ast::TyI16 }
|
||||
impl_to_source_int! { signed, i32, ast::TyI32 }
|
||||
impl_to_source_int! { signed, i64, ast::TyI64 }
|
||||
|
||||
impl_to_source_int! { unsigned, uint, TyUs }
|
||||
impl_to_source_int! { unsigned, u8, TyU8 }
|
||||
impl_to_source_int! { unsigned, u16, TyU16 }
|
||||
impl_to_source_int! { unsigned, u32, TyU32 }
|
||||
impl_to_source_int! { unsigned, u64, TyU64 }
|
||||
impl_to_source_int! { unsigned, uint, ast::TyUs(false) }
|
||||
impl_to_source_int! { unsigned, u8, ast::TyU8 }
|
||||
impl_to_source_int! { unsigned, u16, ast::TyU16 }
|
||||
impl_to_source_int! { unsigned, u32, ast::TyU32 }
|
||||
impl_to_source_int! { unsigned, u64, ast::TyU64 }
|
||||
|
||||
// Alas ... we write these out instead. All redundant.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue