Skip to content

Commit eda02f6

Browse files
committed
---
yaml --- r: 123451 b: refs/heads/auto c: cc42134 h: refs/heads/master i: 123449: 4a728c7 123447: 8bb9f97 v: v3
1 parent 7fa1eda commit eda02f6

File tree

10 files changed

+326
-267
lines changed

10 files changed

+326
-267
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 9f5e21da4ef95e5d2914a76b09848ebc2504c53d
16+
refs/heads/auto: cc4213418e3ab225867d8e3911f592481b1bbffc
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ use syntax::{ast, ast_util};
4242
pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
4343
-> ValueRef {
4444
let _icx = push_ctxt("trans_lit");
45+
debug!("const_lit: {}", lit);
4546
match lit.node {
4647
ast::LitByte(b) => C_integral(Type::uint_from_ty(cx, ast::TyU8), b as u64, false),
4748
ast::LitChar(i) => C_integral(Type::char(cx), i as u64, false),

branches/auto/src/librustdoc/html/highlight.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ fn doit(sess: &parse::ParseSess, mut lexer: lexer::StringReader,
144144
t::LIT_CHAR(..) | t::LIT_STR(..) | t::LIT_STR_RAW(..) => "string",
145145

146146
// number literals
147-
t::LIT_INT(..) | t::LIT_UINT(..) | t::LIT_INT_UNSUFFIXED(..) |
148-
t::LIT_FLOAT(..) | t::LIT_FLOAT_UNSUFFIXED(..) => "number",
147+
t::LIT_INTEGER(..) | t::LIT_FLOAT(..) => "number",
149148

150149
// keywords are also included in the identifier set
151150
t::IDENT(ident, _is_mod_sep) => {

branches/auto/src/libsyntax/ast.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,15 +619,15 @@ pub enum Mac_ {
619619
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
620620
}
621621

622-
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
622+
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
623623
pub enum StrStyle {
624624
CookedStr,
625625
RawStr(uint)
626626
}
627627

628628
pub type Lit = Spanned<Lit_>;
629629

630-
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
630+
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
631631
pub enum Lit_ {
632632
LitStr(InternedString, StrStyle),
633633
LitBinary(Rc<Vec<u8> >),
@@ -697,6 +697,16 @@ impl fmt::Show for IntTy {
697697
}
698698
}
699699

700+
impl IntTy {
701+
pub fn suffix_len(&self) -> uint {
702+
match *self {
703+
TyI => 1,
704+
TyI8 => 2,
705+
TyI16 | TyI32 | TyI64 => 3,
706+
}
707+
}
708+
}
709+
700710
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
701711
pub enum UintTy {
702712
TyU,
@@ -706,6 +716,16 @@ pub enum UintTy {
706716
TyU64,
707717
}
708718

719+
impl UintTy {
720+
pub fn suffix_len(&self) -> uint {
721+
match *self {
722+
TyU => 1,
723+
TyU8 => 2,
724+
TyU16 | TyU32 | TyU64 => 3,
725+
}
726+
}
727+
}
728+
709729
impl fmt::Show for UintTy {
710730
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
711731
write!(f, "{}", ast_util::uint_ty_to_string(*self, None))
@@ -724,6 +744,14 @@ impl fmt::Show for FloatTy {
724744
}
725745
}
726746

747+
impl FloatTy {
748+
pub fn suffix_len(&self) -> uint {
749+
match *self {
750+
TyF32 | TyF64 => 3, // add F128 handling here
751+
}
752+
}
753+
}
754+
727755
// NB PartialEq method appears below.
728756
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
729757
pub struct Ty {

branches/auto/src/libsyntax/codemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub struct Span {
9696

9797
pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None };
9898

99-
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
99+
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
100100
pub struct Spanned<T> {
101101
pub node: T,
102102
pub span: Span,

branches/auto/src/libsyntax/ext/quote.rs

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -412,45 +412,14 @@ fn mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> Gc<ast::Expr> {
412412
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_CHAR"), vec!(e_char));
413413
}
414414

415-
LIT_INT(i, ity) => {
416-
let s_ity = match ity {
417-
ast::TyI => "TyI",
418-
ast::TyI8 => "TyI8",
419-
ast::TyI16 => "TyI16",
420-
ast::TyI32 => "TyI32",
421-
ast::TyI64 => "TyI64"
422-
};
423-
let e_ity = mk_ast_path(cx, sp, s_ity);
424-
let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
425-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INT"), vec!(e_i64, e_ity));
415+
LIT_INTEGER(i) => {
416+
let e_int = mk_ident(cx, sp, i);
417+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INTEGER"), vec!(e_int));
426418
}
427419

428-
LIT_UINT(u, uty) => {
429-
let s_uty = match uty {
430-
ast::TyU => "TyU",
431-
ast::TyU8 => "TyU8",
432-
ast::TyU16 => "TyU16",
433-
ast::TyU32 => "TyU32",
434-
ast::TyU64 => "TyU64"
435-
};
436-
let e_uty = mk_ast_path(cx, sp, s_uty);
437-
let e_u64 = cx.expr_lit(sp, ast::LitUint(u, ast::TyU64));
438-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_UINT"), vec!(e_u64, e_uty));
439-
}
440-
441-
LIT_INT_UNSUFFIXED(i) => {
442-
let e_i64 = cx.expr_lit(sp, ast::LitInt(i, ast::TyI64));
443-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_INT_UNSUFFIXED"), vec!(e_i64));
444-
}
445-
446-
LIT_FLOAT(fident, fty) => {
447-
let s_fty = match fty {
448-
ast::TyF32 => "TyF32",
449-
ast::TyF64 => "TyF64",
450-
};
451-
let e_fty = mk_ast_path(cx, sp, s_fty);
420+
LIT_FLOAT(fident) => {
452421
let e_fident = mk_ident(cx, sp, fident);
453-
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_FLOAT"), vec!(e_fident, e_fty));
422+
return cx.expr_call(sp, mk_token_path(cx, sp, "LIT_FLOAT"), vec!(e_fident));
454423
}
455424

456425
LIT_STR(ident) => {

0 commit comments

Comments
 (0)