syntax/rustc: implement isize/usize

This commit is contained in:
Corey Richardson 2014-12-05 18:11:46 -08:00
parent 6539cb417f
commit abcbe27695
22 changed files with 81 additions and 78 deletions

View file

@ -642,10 +642,10 @@ 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::TyU)))
self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
}
fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr> {
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyI, ast::Sign::new(i))))
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs, 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)))

View file

@ -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::TyU));
let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs));
cx.arm(sp, vec![pat], cx.expr_lit(sp, lit))
}).collect();

View file

@ -273,13 +273,13 @@ pub mod rt {
);
}
impl_to_source_int! { signed, int, TyI }
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! { unsigned, uint, TyU }
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 }