libsyntax: Never use ::<>
in the type grammar
This commit is contained in:
parent
0847d52a86
commit
9c4d804cfe
7 changed files with 14 additions and 16 deletions
|
@ -986,7 +986,7 @@ pub trait WriterUtil {
|
||||||
|
|
||||||
impl<T:Writer> WriterUtil for T {
|
impl<T:Writer> WriterUtil for T {
|
||||||
fn write_char(&self, ch: char) {
|
fn write_char(&self, ch: char) {
|
||||||
if ch as uint < 128u {
|
if (ch as uint) < 128u {
|
||||||
self.write(&[ch as u8]);
|
self.write(&[ch as u8]);
|
||||||
} else {
|
} else {
|
||||||
self.write_str(str::from_char(ch));
|
self.write_str(str::from_char(ch));
|
||||||
|
|
|
@ -165,7 +165,7 @@ pub pure fn to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Copy+
|
||||||
Div<T,T>+Neg<T>+Modulo<T,T>+Mul<T,T>>(
|
Div<T,T>+Neg<T>+Modulo<T,T>+Mul<T,T>>(
|
||||||
num: &T, radix: uint, negative_zero: bool,
|
num: &T, radix: uint, negative_zero: bool,
|
||||||
sign: SignFormat, digits: SignificantDigits) -> (~[u8], bool) {
|
sign: SignFormat, digits: SignificantDigits) -> (~[u8], bool) {
|
||||||
if radix as int < 2 {
|
if (radix as int) < 2 {
|
||||||
fail!(fmt!("to_str_bytes_common: radix %? to low, \
|
fail!(fmt!("to_str_bytes_common: radix %? to low, \
|
||||||
must lie in the range [2, 36]", radix));
|
must lie in the range [2, 36]", radix));
|
||||||
} else if radix as int > 36 {
|
} else if radix as int > 36 {
|
||||||
|
@ -455,10 +455,10 @@ pub pure fn from_str_bytes_common<T:NumCast+Zero+One+Ord+Copy+Div<T,T>+
|
||||||
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
|
_ if special && radix >= DIGIT_I_RADIX // first digit of 'inf'
|
||||||
=> fail!(fmt!("from_str_bytes_common: radix %? incompatible with \
|
=> fail!(fmt!("from_str_bytes_common: radix %? incompatible with \
|
||||||
special values 'inf' and 'NaN'", radix)),
|
special values 'inf' and 'NaN'", radix)),
|
||||||
_ if radix as int < 2
|
_ if (radix as int) < 2
|
||||||
=> fail!(fmt!("from_str_bytes_common: radix %? to low, \
|
=> fail!(fmt!("from_str_bytes_common: radix %? to low, \
|
||||||
must lie in the range [2, 36]", radix)),
|
must lie in the range [2, 36]", radix)),
|
||||||
_ if radix as int > 36
|
_ if (radix as int) > 36
|
||||||
=> fail!(fmt!("from_str_bytes_common: radix %? to high, \
|
=> fail!(fmt!("from_str_bytes_common: radix %? to high, \
|
||||||
must lie in the range [2, 36]", radix)),
|
must lie in the range [2, 36]", radix)),
|
||||||
_ => ()
|
_ => ()
|
||||||
|
|
|
@ -242,7 +242,7 @@ pub impl ReprVisitor {
|
||||||
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
|
let (sz, al) = unsafe { ((*inner).size, (*inner).align) };
|
||||||
self.writer.write_char('[');
|
self.writer.write_char('[');
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
while p as uint < end as uint {
|
while (p as uint) < (end as uint) {
|
||||||
if first {
|
if first {
|
||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -536,7 +536,7 @@ pub mod rt {
|
||||||
// displayed
|
// displayed
|
||||||
let mut unpadded = match cv.precision {
|
let mut unpadded = match cv.precision {
|
||||||
CountImplied => s.to_owned(),
|
CountImplied => s.to_owned(),
|
||||||
CountIs(max) => if max as uint < str::char_len(s) {
|
CountIs(max) => if (max as uint) < str::char_len(s) {
|
||||||
str::substr(s, 0, max as uint)
|
str::substr(s, 0, max as uint)
|
||||||
} else {
|
} else {
|
||||||
s.to_owned()
|
s.to_owned()
|
||||||
|
|
|
@ -819,8 +819,8 @@ priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
|
||||||
'M' => fmt!("%02d", tm.tm_min as int),
|
'M' => fmt!("%02d", tm.tm_min as int),
|
||||||
'm' => fmt!("%02d", tm.tm_mon as int + 1),
|
'm' => fmt!("%02d", tm.tm_mon as int + 1),
|
||||||
'n' => ~"\n",
|
'n' => ~"\n",
|
||||||
'P' => if tm.tm_hour as int < 12 { ~"am" } else { ~"pm" },
|
'P' => if (tm.tm_hour as int) < 12 { ~"am" } else { ~"pm" },
|
||||||
'p' => if tm.tm_hour as int < 12 { ~"AM" } else { ~"PM" },
|
'p' => if (tm.tm_hour as int) < 12 { ~"AM" } else { ~"PM" },
|
||||||
'R' => {
|
'R' => {
|
||||||
fmt!("%s:%s",
|
fmt!("%s:%s",
|
||||||
parse_type('H', tm),
|
parse_type('H', tm),
|
||||||
|
|
|
@ -581,7 +581,9 @@ pub impl Parser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_ty(&self, colons_before_params: bool) -> @Ty {
|
// Useless second parameter for compatibility with quasiquote macros.
|
||||||
|
// Bleh!
|
||||||
|
fn parse_ty(&self, _: bool) -> @Ty {
|
||||||
maybe_whole!(self, nt_ty);
|
maybe_whole!(self, nt_ty);
|
||||||
|
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
@ -661,7 +663,7 @@ pub impl Parser {
|
||||||
result
|
result
|
||||||
} else if *self.token == token::MOD_SEP
|
} else if *self.token == token::MOD_SEP
|
||||||
|| is_ident_or_path(&*self.token) {
|
|| is_ident_or_path(&*self.token) {
|
||||||
let path = self.parse_path_with_tps(colons_before_params);
|
let path = self.parse_path_with_tps(false);
|
||||||
ty_path(path, self.get_id())
|
ty_path(path, self.get_id())
|
||||||
} else {
|
} else {
|
||||||
self.fatal(~"expected type");
|
self.fatal(~"expected type");
|
||||||
|
|
|
@ -370,10 +370,6 @@ pub fn print_opt_lifetime(s: @ps, lifetime: Option<@ast::Lifetime>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_type(s: @ps, &&ty: @ast::Ty) {
|
pub fn print_type(s: @ps, &&ty: @ast::Ty) {
|
||||||
print_type_ex(s, ty, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
|
|
||||||
maybe_print_comment(s, ty.span.lo);
|
maybe_print_comment(s, ty.span.lo);
|
||||||
ibox(s, 0u);
|
ibox(s, 0u);
|
||||||
match ty.node {
|
match ty.node {
|
||||||
|
@ -415,7 +411,7 @@ pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
|
||||||
f.purity, f.onceness, &f.decl, None,
|
f.purity, f.onceness, &f.decl, None,
|
||||||
None, None);
|
None, None);
|
||||||
}
|
}
|
||||||
ast::ty_path(path, _) => print_path(s, path, print_colons),
|
ast::ty_path(path, _) => print_path(s, path, false),
|
||||||
ast::ty_fixed_length_vec(ref mt, v) => {
|
ast::ty_fixed_length_vec(ref mt, v) => {
|
||||||
word(s.s, ~"[");
|
word(s.s, ~"[");
|
||||||
match mt.mutbl {
|
match mt.mutbl {
|
||||||
|
@ -1211,7 +1207,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
|
||||||
print_expr(s, expr);
|
print_expr(s, expr);
|
||||||
space(s.s);
|
space(s.s);
|
||||||
word_space(s, ~"as");
|
word_space(s, ~"as");
|
||||||
print_type_ex(s, ty, true);
|
print_type(s, ty);
|
||||||
}
|
}
|
||||||
ast::expr_if(test, ref blk, elseopt) => {
|
ast::expr_if(test, ref blk, elseopt) => {
|
||||||
print_if(s, test, blk, elseopt, false);
|
print_if(s, test, blk, elseopt, false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue