libsyntax: int types -> isize
This commit is contained in:
parent
7a24b3a4d7
commit
591337431d
7 changed files with 40 additions and 40 deletions
|
|
@ -135,7 +135,7 @@ pub trait AstBuilder {
|
|||
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
|
||||
|
||||
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>;
|
||||
fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr>;
|
||||
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr>;
|
||||
fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
|
||||
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
|
||||
|
||||
|
|
@ -644,7 +644,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
|||
fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> {
|
||||
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> {
|
||||
fn expr_int(&self, sp: Span, i: isize) -> P<ast::Expr> {
|
||||
self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs(false),
|
||||
ast::Sign::new(i))))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ fn read_block_comment(rdr: &mut StringReader,
|
|||
assert!(!curr_line.contains_char('\n'));
|
||||
lines.push(curr_line);
|
||||
} else {
|
||||
let mut level: int = 1;
|
||||
let mut level: isize = 1;
|
||||
while level > 0 {
|
||||
debug!("=== block comment level {}", level);
|
||||
if rdr.is_eof() {
|
||||
|
|
|
|||
|
|
@ -519,7 +519,7 @@ impl<'a> StringReader<'a> {
|
|||
let is_doc_comment = self.curr_is('*') || self.curr_is('!');
|
||||
let start_bpos = self.last_pos - BytePos(2);
|
||||
|
||||
let mut level: int = 1;
|
||||
let mut level: isize = 1;
|
||||
let mut has_cr = false;
|
||||
while level > 0 {
|
||||
if self.is_eof() {
|
||||
|
|
|
|||
|
|
@ -290,8 +290,8 @@ pub struct Parser<'a> {
|
|||
/// the previous token or None (only stashed sometimes).
|
||||
pub last_token: Option<Box<token::Token>>,
|
||||
pub buffer: [TokenAndSpan; 4],
|
||||
pub buffer_start: int,
|
||||
pub buffer_end: int,
|
||||
pub buffer_start: isize,
|
||||
pub buffer_end: isize,
|
||||
pub tokens_consumed: usize,
|
||||
pub restrictions: Restrictions,
|
||||
pub quote_depth: usize, // not (yet) related to the quasiquoter
|
||||
|
|
@ -934,7 +934,7 @@ impl<'a> Parser<'a> {
|
|||
// Avoid token copies with `replace`.
|
||||
let buffer_start = self.buffer_start as usize;
|
||||
let next_index = (buffer_start + 1) & 3 as usize;
|
||||
self.buffer_start = next_index as int;
|
||||
self.buffer_start = next_index as isize;
|
||||
|
||||
let placeholder = TokenAndSpan {
|
||||
tok: token::Underscore,
|
||||
|
|
@ -966,7 +966,7 @@ impl<'a> Parser<'a> {
|
|||
self.token = next;
|
||||
self.span = mk_sp(lo, hi);
|
||||
}
|
||||
pub fn buffer_length(&mut self) -> int {
|
||||
pub fn buffer_length(&mut self) -> isize {
|
||||
if self.buffer_start <= self.buffer_end {
|
||||
return self.buffer_end - self.buffer_start;
|
||||
}
|
||||
|
|
@ -975,7 +975,7 @@ impl<'a> Parser<'a> {
|
|||
pub fn look_ahead<R, F>(&mut self, distance: usize, f: F) -> R where
|
||||
F: FnOnce(&token::Token) -> R,
|
||||
{
|
||||
let dist = distance as int;
|
||||
let dist = distance as isize;
|
||||
while self.buffer_length() < dist {
|
||||
self.buffer[self.buffer_end as usize] = self.reader.real_token();
|
||||
self.buffer_end = (self.buffer_end + 1) & 3;
|
||||
|
|
|
|||
|
|
@ -71,19 +71,19 @@ pub enum Breaks {
|
|||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct BreakToken {
|
||||
offset: int,
|
||||
blank_space: int
|
||||
offset: isize,
|
||||
blank_space: isize
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct BeginToken {
|
||||
offset: int,
|
||||
offset: isize,
|
||||
breaks: Breaks
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Token {
|
||||
String(String, int),
|
||||
String(String, isize),
|
||||
Break(BreakToken),
|
||||
Begin(BeginToken),
|
||||
End,
|
||||
|
|
@ -122,7 +122,7 @@ pub fn tok_str(token: &Token) -> String {
|
|||
}
|
||||
|
||||
pub fn buf_str(toks: &[Token],
|
||||
szs: &[int],
|
||||
szs: &[isize],
|
||||
left: usize,
|
||||
right: usize,
|
||||
lim: usize)
|
||||
|
|
@ -155,11 +155,11 @@ pub enum PrintStackBreak {
|
|||
|
||||
#[derive(Copy)]
|
||||
pub struct PrintStackElem {
|
||||
offset: int,
|
||||
offset: isize,
|
||||
pbreak: PrintStackBreak
|
||||
}
|
||||
|
||||
static SIZE_INFINITY: int = 0xffff;
|
||||
static SIZE_INFINITY: isize = 0xffff;
|
||||
|
||||
pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: usize) -> Printer {
|
||||
// Yes 3, it makes the ring buffers big enough to never
|
||||
|
|
@ -167,13 +167,13 @@ pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: usize) -> Printer {
|
|||
let n: usize = 3 * linewidth;
|
||||
debug!("mk_printer {}", linewidth);
|
||||
let token: Vec<Token> = repeat(Token::Eof).take(n).collect();
|
||||
let size: Vec<int> = repeat(0i).take(n).collect();
|
||||
let size: Vec<isize> = repeat(0i).take(n).collect();
|
||||
let scan_stack: Vec<usize> = repeat(0us).take(n).collect();
|
||||
Printer {
|
||||
out: out,
|
||||
buf_len: n,
|
||||
margin: linewidth as int,
|
||||
space: linewidth as int,
|
||||
margin: linewidth as isize,
|
||||
space: linewidth as isize,
|
||||
left: 0,
|
||||
right: 0,
|
||||
token: token,
|
||||
|
|
@ -269,9 +269,9 @@ pub struct Printer {
|
|||
pub out: Box<io::Writer+'static>,
|
||||
buf_len: usize,
|
||||
/// Width of lines we're constrained to
|
||||
margin: int,
|
||||
margin: isize,
|
||||
/// Number of spaces left on line
|
||||
space: int,
|
||||
space: isize,
|
||||
/// Index of left side of input stream
|
||||
left: usize,
|
||||
/// Index of right side of input stream
|
||||
|
|
@ -279,11 +279,11 @@ pub struct Printer {
|
|||
/// Ring-buffer stream goes through
|
||||
token: Vec<Token> ,
|
||||
/// Ring-buffer of calculated sizes
|
||||
size: Vec<int> ,
|
||||
size: Vec<isize> ,
|
||||
/// Running size of stream "...left"
|
||||
left_total: int,
|
||||
left_total: isize,
|
||||
/// Running size of stream "...right"
|
||||
right_total: int,
|
||||
right_total: isize,
|
||||
/// Pseudo-stack, really a ring too. Holds the
|
||||
/// primary-ring-buffers index of the Begin that started the
|
||||
/// current block, possibly with the most recent Break after that
|
||||
|
|
@ -300,7 +300,7 @@ pub struct Printer {
|
|||
/// Stack of blocks-in-progress being flushed by print
|
||||
print_stack: Vec<PrintStackElem> ,
|
||||
/// Buffered indentation to avoid writing trailing whitespace
|
||||
pending_indentation: int,
|
||||
pending_indentation: isize,
|
||||
}
|
||||
|
||||
impl Printer {
|
||||
|
|
@ -479,7 +479,7 @@ impl Printer {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
pub fn check_stack(&mut self, k: int) {
|
||||
pub fn check_stack(&mut self, k: isize) {
|
||||
if !self.scan_stack_empty {
|
||||
let x = self.scan_top();
|
||||
match self.token[x] {
|
||||
|
|
@ -506,14 +506,14 @@ impl Printer {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn print_newline(&mut self, amount: int) -> io::IoResult<()> {
|
||||
pub fn print_newline(&mut self, amount: isize) -> io::IoResult<()> {
|
||||
debug!("NEWLINE {}", amount);
|
||||
let ret = write!(self.out, "\n");
|
||||
self.pending_indentation = 0;
|
||||
self.indent(amount);
|
||||
return ret;
|
||||
}
|
||||
pub fn indent(&mut self, amount: int) {
|
||||
pub fn indent(&mut self, amount: isize) {
|
||||
debug!("INDENT {}", amount);
|
||||
self.pending_indentation += amount;
|
||||
}
|
||||
|
|
@ -536,7 +536,7 @@ impl Printer {
|
|||
}
|
||||
write!(self.out, "{}", s)
|
||||
}
|
||||
pub fn print(&mut self, token: Token, l: int) -> io::IoResult<()> {
|
||||
pub fn print(&mut self, token: Token, l: isize) -> io::IoResult<()> {
|
||||
debug!("print {} {} (remaining line space={})", tok_str(&token), l,
|
||||
self.space);
|
||||
debug!("{}", buf_str(&self.token[],
|
||||
|
|
@ -622,7 +622,7 @@ impl Printer {
|
|||
// "raw box"
|
||||
pub fn rbox(p: &mut Printer, indent: usize, b: Breaks) -> io::IoResult<()> {
|
||||
p.pretty_print(Token::Begin(BeginToken {
|
||||
offset: indent as int,
|
||||
offset: indent as isize,
|
||||
breaks: b
|
||||
}))
|
||||
}
|
||||
|
|
@ -635,10 +635,10 @@ pub fn cbox(p: &mut Printer, indent: usize) -> io::IoResult<()> {
|
|||
rbox(p, indent, Breaks::Consistent)
|
||||
}
|
||||
|
||||
pub fn break_offset(p: &mut Printer, n: usize, off: int) -> io::IoResult<()> {
|
||||
pub fn break_offset(p: &mut Printer, n: usize, off: isize) -> io::IoResult<()> {
|
||||
p.pretty_print(Token::Break(BreakToken {
|
||||
offset: off,
|
||||
blank_space: n as int
|
||||
blank_space: n as isize
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -651,7 +651,7 @@ pub fn eof(p: &mut Printer) -> io::IoResult<()> {
|
|||
}
|
||||
|
||||
pub fn word(p: &mut Printer, wrd: &str) -> io::IoResult<()> {
|
||||
p.pretty_print(Token::String(/* bad */ wrd.to_string(), wrd.len() as int))
|
||||
p.pretty_print(Token::String(/* bad */ wrd.to_string(), wrd.len() as isize))
|
||||
}
|
||||
|
||||
pub fn huge_word(p: &mut Printer, wrd: &str) -> io::IoResult<()> {
|
||||
|
|
@ -678,7 +678,7 @@ pub fn hardbreak(p: &mut Printer) -> io::IoResult<()> {
|
|||
spaces(p, SIZE_INFINITY as usize)
|
||||
}
|
||||
|
||||
pub fn hardbreak_tok_offset(off: int) -> Token {
|
||||
pub fn hardbreak_tok_offset(off: isize) -> Token {
|
||||
Token::Break(BreakToken {offset: off, blank_space: SIZE_INFINITY})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ impl<'a> State<'a> {
|
|||
pub fn bclose_maybe_open (&mut self, span: codemap::Span,
|
||||
indented: usize, close_box: bool) -> IoResult<()> {
|
||||
try!(self.maybe_print_comment(span.hi));
|
||||
try!(self.break_offset_if_not_bol(1u, -(indented as int)));
|
||||
try!(self.break_offset_if_not_bol(1u, -(indented as isize)));
|
||||
try!(word(&mut self.s, "}"));
|
||||
if close_box {
|
||||
try!(self.end()); // close the outer-box
|
||||
|
|
@ -568,7 +568,7 @@ impl<'a> State<'a> {
|
|||
Ok(())
|
||||
}
|
||||
pub fn break_offset_if_not_bol(&mut self, n: usize,
|
||||
off: int) -> IoResult<()> {
|
||||
off: isize) -> IoResult<()> {
|
||||
if !self.is_bol() {
|
||||
break_offset(&mut self.s, n, off)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_len() {
|
||||
let v: SmallVector<int> = SmallVector::zero();
|
||||
let v: SmallVector<isize> = SmallVector::zero();
|
||||
assert_eq!(0, v.len());
|
||||
|
||||
assert_eq!(1, SmallVector::one(1i).len());
|
||||
|
|
@ -214,7 +214,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn test_from_iter() {
|
||||
let v: SmallVector<int> = (vec!(1i, 2, 3)).into_iter().collect();
|
||||
let v: SmallVector<isize> = (vec![1is, 2, 3]).into_iter().collect();
|
||||
assert_eq!(3, v.len());
|
||||
assert_eq!(&1, v.get(0));
|
||||
assert_eq!(&2, v.get(1));
|
||||
|
|
@ -224,7 +224,7 @@ mod test {
|
|||
#[test]
|
||||
fn test_move_iter() {
|
||||
let v = SmallVector::zero();
|
||||
let v: Vec<int> = v.into_iter().collect();
|
||||
let v: Vec<isize> = v.into_iter().collect();
|
||||
assert_eq!(Vec::new(), v);
|
||||
|
||||
let v = SmallVector::one(1i);
|
||||
|
|
@ -237,7 +237,7 @@ mod test {
|
|||
#[test]
|
||||
#[should_fail]
|
||||
fn test_expect_one_zero() {
|
||||
let _: int = SmallVector::zero().expect_one("");
|
||||
let _: isize = SmallVector::zero().expect_one("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue