let ident = path1.node;
if let ast::BindByValue(ast::MutMutable) = mode {
if !token::get_ident(ident).get().starts_with("_") {
- match mutables.entry(ident.name.uint()) {
+ match mutables.entry(ident.name.usize()) {
Vacant(entry) => { entry.insert(vec![id]); },
Occupied(mut entry) => { entry.get_mut().push(id); },
}
fn explain_span(cx: &ctxt, heading: &str, span: Span)
-> (String, Option<Span>) {
let lo = cx.sess.codemap().lookup_char_pos_adj(span.lo);
- (format!("the {} at {}:{}", heading, lo.line, lo.col.to_uint()),
+ (format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize()),
Some(span))
}
}
let module_name = self.module_to_string(&*search_module);
let mut span = span;
let msg = if "???" == &module_name[] {
- span.hi = span.lo + Pos::from_uint(segment_name.get().len());
+ span.hi = span.lo + Pos::from_usize(segment_name.get().len());
match search_parent_externals(name,
&self.current_module) {
format!("file_name,{},file_line,{},file_col,{},extent_start,{},extent_start_bytes,{},\
file_line_end,{},file_col_end,{},extent_end,{},extent_end_bytes,{}",
lo_loc.file.name,
- lo_loc.line, lo_loc.col.to_uint(), lo_pos.to_uint(), lo_pos_byte.to_uint(),
- hi_loc.line, hi_loc.col.to_uint(), hi_pos.to_uint(), hi_pos_byte.to_uint())
+ lo_loc.line, lo_loc.col.to_usize(), lo_pos.to_usize(), lo_pos_byte.to_usize(),
+ hi_loc.line, hi_loc.col.to_usize(), hi_pos.to_usize(), hi_pos_byte.to_usize())
}
// sub_span starts at span.lo, so we need to adjust the positions etc.
/// Generates a unique symbol based off the name given. This is used to create
/// unique symbols for things like closures.
pub fn gensym_name(name: &str) -> PathElem {
- let num = token::gensym(name).uint();
+ let num = token::gensym(name).usize();
// use one colon which will get translated to a period by the mangler, and
// we're guaranteed that `num` is globally unique for this crate.
PathName(token::gensym(&format!("{}:{}", name, num)[]))
!null_terminated as Bool);
let gsym = token::gensym("str");
- let buf = CString::from_vec(format!("str{}", gsym.uint()).into_bytes());
+ let buf = CString::from_vec(format!("str{}", gsym.usize()).into_bytes());
let g = llvm::LLVMAddGlobal(cx.llmod(), val_ty(sc).to_ref(), buf.as_ptr());
llvm::LLVMSetInitializer(g, sc);
llvm::LLVMSetGlobalConstant(g, True);
let lldata = C_bytes(cx, data);
let gsym = token::gensym("binary");
- let name = format!("binary{}", gsym.uint());
+ let name = format!("binary{}", gsym.usize());
let name = CString::from_vec(name.into_bytes());
let g = llvm::LLVMAddGlobal(cx.llmod(), val_ty(lldata).to_ref(),
name.as_ptr());
set_debug_location(cx, DebugLocation::new(scope,
loc.line,
- loc.col.to_uint()));
+ loc.col.to_usize()));
} else {
set_debug_location(cx, UnknownLocation);
}
set_debug_location(cx, DebugLocation::new(scope_metadata,
loc.line,
- loc.col.to_uint()));
+ loc.col.to_usize()));
unsafe {
let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
DIB(cx),
parent_scope,
file_metadata,
loc.line as c_uint,
- loc.col.to_uint() as c_uint)
+ loc.col.to_usize() as c_uint)
};
scope_stack.push(ScopeStackEntry { scope_metadata: scope_metadata,
parent_scope,
file_metadata,
loc.line as c_uint,
- loc.col.to_uint() as c_uint)
+ loc.col.to_usize() as c_uint)
};
scope_stack.push(ScopeStackEntry {
unsafe {
let tbl = C_struct(ccx, &components[], false);
let sym = token::gensym("vtable");
- let buf = CString::from_vec(format!("vtable{}", sym.uint()).into_bytes());
+ let buf = CString::from_vec(format!("vtable{}", sym.usize()).into_bytes());
let vt_gvar = llvm::LLVMAddGlobal(ccx.llmod(), val_ty(tbl).to_ref(),
buf.as_ptr());
llvm::LLVMSetInitializer(vt_gvar, tbl);
Span {
filename: filename.to_string(),
loline: lo.line,
- locol: lo.col.to_uint(),
+ locol: lo.col.to_usize(),
hiline: hi.line,
- hicol: hi.col.to_uint(),
+ hicol: hi.col.to_usize(),
}
}
}
pub fn encode_with_hygiene(&self) -> String {
format!("\x00name_{},ctxt_{}\x00",
- self.name.uint(),
+ self.name.usize(),
self.ctxt)
}
}
}
}
- pub fn uint(&self) -> usize {
+ pub fn usize(&self) -> usize {
let Name(nm) = *self;
nm as usize
}
use serialize::{Encodable, Decodable, Encoder, Decoder};
pub trait Pos {
- fn from_uint(n: usize) -> Self;
- fn to_uint(&self) -> usize;
+ fn from_usize(n: usize) -> Self;
+ fn to_usize(&self) -> usize;
}
/// A byte offset. Keep this small (currently 32-bits), as AST contains
// have been unsuccessful
impl Pos for BytePos {
- fn from_uint(n: usize) -> BytePos { BytePos(n as u32) }
- fn to_uint(&self) -> usize { let BytePos(n) = *self; n as usize }
+ fn from_usize(n: usize) -> BytePos { BytePos(n as u32) }
+ fn to_usize(&self) -> usize { let BytePos(n) = *self; n as usize }
}
impl Add for BytePos {
type Output = BytePos;
fn add(self, rhs: BytePos) -> BytePos {
- BytePos((self.to_uint() + rhs.to_uint()) as u32)
+ BytePos((self.to_usize() + rhs.to_usize()) as u32)
}
}
type Output = BytePos;
fn sub(self, rhs: BytePos) -> BytePos {
- BytePos((self.to_uint() - rhs.to_uint()) as u32)
+ BytePos((self.to_usize() - rhs.to_usize()) as u32)
}
}
impl Pos for CharPos {
- fn from_uint(n: usize) -> CharPos { CharPos(n) }
- fn to_uint(&self) -> usize { let CharPos(n) = *self; n }
+ fn from_usize(n: usize) -> CharPos { CharPos(n) }
+ fn to_usize(&self) -> usize { let CharPos(n) = *self; n }
}
impl Add for CharPos {
type Output = CharPos;
fn add(self, rhs: CharPos) -> CharPos {
- CharPos(self.to_uint() + rhs.to_uint())
+ CharPos(self.to_usize() + rhs.to_usize())
}
}
type Output = CharPos;
fn sub(self, rhs: CharPos) -> CharPos {
- CharPos(self.to_uint() - rhs.to_uint())
+ CharPos(self.to_usize() - rhs.to_usize())
}
}
let lines = self.lines.borrow();
lines.get(line_number).map(|&line| {
let begin: BytePos = line - self.start_pos;
- let begin = begin.to_uint();
+ let begin = begin.to_usize();
let slice = &self.src[begin..];
match slice.find('\n') {
Some(e) => &slice[..e],
let mut files = self.files.borrow_mut();
let start_pos = match files.last() {
None => 0,
- Some(last) => last.start_pos.to_uint() + last.src.len(),
+ Some(last) => last.start_pos.to_usize() + last.src.len(),
};
// Remove utf-8 BOM if any.
let filemap = Rc::new(FileMap {
name: filename,
src: src.to_string(),
- start_pos: Pos::from_uint(start_pos),
+ start_pos: Pos::from_usize(start_pos),
lines: RefCell::new(Vec::new()),
multibyte_chars: RefCell::new(Vec::new()),
});
(format!("<{}:{}:{}>",
pos.file.name,
pos.line,
- pos.col.to_uint() + 1)).to_string()
+ pos.col.to_usize() + 1)).to_string()
}
/// Lookup source information about a BytePos
return (format!("{}:{}:{}: {}:{}",
lo.filename,
lo.line,
- lo.col.to_uint() + 1,
+ lo.col.to_usize() + 1,
hi.line,
- hi.col.to_uint() + 1)).to_string()
+ hi.col.to_usize() + 1)).to_string()
}
pub fn span_to_filename(&self, sp: Span) -> FileName {
if begin.fm.start_pos != end.fm.start_pos {
None
} else {
- Some((&begin.fm.src[begin.pos.to_uint()..end.pos.to_uint()]).to_string())
+ Some((&begin.fm.src[begin.pos.to_usize()..end.pos.to_usize()]).to_string())
}
}
total_extra_bytes += mbc.bytes - 1;
// We should never see a byte position in the middle of a
// character
- assert!(bpos.to_uint() >= mbc.pos.to_uint() + mbc.bytes);
+ assert!(bpos.to_usize() >= mbc.pos.to_usize() + mbc.bytes);
} else {
break;
}
}
- assert!(map.start_pos.to_uint() + total_extra_bytes <= bpos.to_uint());
- CharPos(bpos.to_uint() - map.start_pos.to_uint() - total_extra_bytes)
+ assert!(map.start_pos.to_usize() + total_extra_bytes <= bpos.to_usize());
+ CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes)
}
fn lookup_filemap_idx(&self, pos: BytePos) -> usize {
}
if a == 0 {
panic!("position {} does not resolve to a source location",
- pos.to_uint());
+ pos.to_usize());
}
a -= 1;
}
if a >= len {
panic!("position {} does not resolve to a source location",
- pos.to_uint())
+ pos.to_usize())
}
return a;
while num > 0u { num /= 10u; digits += 1u; }
// indent past |name:## | and the 0-offset column location
- let left = fm.name.len() + digits + lo.col.to_uint() + 3u;
+ let left = fm.name.len() + digits + lo.col.to_usize() + 3u;
let mut s = String::new();
// Skip is the number of characters we need to skip because they are
// part of the 'filename:line ' part of the previous line.
let hi = cm.lookup_char_pos(sp.hi);
if hi.col != lo.col {
// the ^ already takes up one space
- let num_squigglies = hi.col.to_uint() - lo.col.to_uint() - 1u;
+ let num_squigglies = hi.col.to_usize() - lo.col.to_usize() - 1us;
for _ in range(0, num_squigglies) {
s.push('~');
}
let last_line_start = format!("{}:{} ", fm.name, lines[lines.len()-1]+1);
let hi = cm.lookup_char_pos(sp.hi);
// Span seems to use half-opened interval, so subtract 1
- let skip = last_line_start.len() + hi.col.to_uint() - 1;
+ let skip = last_line_start.len() + hi.col.to_usize() - 1;
let mut s = String::new();
for _ in range(0, skip) {
s.push(' ');
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>;
- fn expr_uint(&self, span: Span, i: usize) -> 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_u8(&self, sp: Span, u: u8) -> P<ast::Expr>;
fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr>;
fn expr_field_access(&self, sp: Span, expr: P<ast::Expr>, ident: ast::Ident) -> P<ast::Expr> {
let field_name = token::get_ident(ident);
let field_span = Span {
- lo: sp.lo - Pos::from_uint(field_name.get().len()),
+ lo: sp.lo - Pos::from_usize(field_name.get().len()),
hi: sp.hi,
expn_id: sp.expn_id,
};
}
fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: usize) -> P<ast::Expr> {
let field_span = Span {
- lo: sp.lo - Pos::from_uint(idx.to_string().len()),
+ lo: sp.lo - Pos::from_usize(idx.to_string().len()),
hi: sp.hi,
expn_id: sp.expn_id,
};
fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr> {
self.expr(sp, ast::ExprLit(P(respan(sp, lit))))
}
- fn expr_uint(&self, span: Span, i: usize) -> P<ast::Expr> {
+ 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> {
let loc = self.codemap().lookup_char_pos(span.lo);
let expr_file = self.expr_str(span,
token::intern_and_get_ident(&loc.file.name[]));
- let expr_line = self.expr_uint(span, loc.line);
+ let expr_line = self.expr_usize(span, loc.line);
let expr_file_line_tuple = self.expr_tuple(span, vec!(expr_file, expr_line));
let expr_file_line_ptr = self.expr_addr_of(span, expr_file_line_tuple);
self.expr_call_global(
cx.expr_try(span,
cx.expr_method_call(span, blkdecoder.clone(), read_struct_field,
vec!(cx.expr_str(span, name),
- cx.expr_uint(span, field),
+ cx.expr_usize(span, field),
exprdecode.clone())))
});
let result = cx.expr_ok(trait_span, result);
cx.ident_of("read_struct"),
vec!(
cx.expr_str(trait_span, token::get_ident(substr.type_ident)),
- cx.expr_uint(trait_span, nfields),
+ cx.expr_usize(trait_span, nfields),
cx.lambda_expr_1(trait_span, result, blkarg)
))
}
path,
parts,
|cx, span, _, field| {
- let idx = cx.expr_uint(span, field);
+ let idx = cx.expr_usize(span, field);
cx.expr_try(span,
cx.expr_method_call(span, blkdecoder.clone(), rvariant_arg,
vec!(idx, exprdecode.clone())))
});
arms.push(cx.arm(v_span,
- vec!(cx.pat_lit(v_span, cx.expr_uint(v_span, i))),
+ vec!(cx.pat_lit(v_span, cx.expr_usize(v_span, i))),
decoded));
}
StaticEnum(..) => {
cx.span_err(trait_span, "`Default` cannot be derived for enums, only structs");
// let compilation continue
- cx.expr_uint(trait_span, 0)
+ cx.expr_usize(trait_span, 0)
}
_ => cx.span_bug(trait_span, "Non-static method in `deriving(Default)`")
};
//! s.emit_struct("Node", 1, |this| {
//! this.emit_struct_field("id", 0, |this| {
//! Encodable::encode(&self.id, this)
-//! /* this.emit_uint(self.id) can also be used */
+//! /* this.emit_usize(self.id) can also be used */
//! })
//! })
//! }
let call = cx.expr_method_call(span, blkencoder.clone(),
emit_struct_field,
vec!(cx.expr_str(span, name),
- cx.expr_uint(span, i),
+ cx.expr_usize(span, i),
lambda));
// last call doesn't need a try!
cx.ident_of("emit_struct"),
vec!(
cx.expr_str(trait_span, token::get_ident(substr.type_ident)),
- cx.expr_uint(trait_span, fields.len()),
+ cx.expr_usize(trait_span, fields.len()),
blk
))
}
let lambda = cx.lambda_expr_1(span, enc, blkarg);
let call = cx.expr_method_call(span, blkencoder.clone(),
emit_variant_arg,
- vec!(cx.expr_uint(span, i),
+ vec!(cx.expr_usize(span, i),
lambda));
let call = if i != last {
cx.expr_try(span, call)
let call = cx.expr_method_call(trait_span, blkencoder,
cx.ident_of("emit_enum_variant"),
vec!(name,
- cx.expr_uint(trait_span, idx),
- cx.expr_uint(trait_span, fields.len()),
+ cx.expr_usize(trait_span, idx),
+ cx.expr_usize(trait_span, fields.len()),
blk));
let blk = cx.lambda_expr_1(trait_span, call, blkarg);
let ret = cx.expr_method_call(trait_span,
// iteration function.
let discriminant = match variant.node.disr_expr {
Some(ref d) => d.clone(),
- None => cx.expr_uint(trait_span, index)
+ None => cx.expr_usize(trait_span, index)
};
stmts.push(call_hash(trait_span, discriminant));
if variants.is_empty() {
cx.span_err(trait_span, "`Rand` cannot be derived for enums with no variants");
// let compilation continue
- return cx.expr_uint(trait_span, 0);
+ return cx.expr_usize(trait_span, 0);
}
- let variant_count = cx.expr_uint(trait_span, variants.len());
+ let variant_count = cx.expr_usize(trait_span, variants.len());
let rand_name = cx.path_all(trait_span,
true,
variant_count);
let mut arms = variants.iter().enumerate().map(|(i, &(ident, v_span, ref summary))| {
- let i_expr = cx.expr_uint(v_span, i);
+ let i_expr = cx.expr_usize(v_span, i);
let pat = cx.pat_lit(v_span, i_expr);
let path = cx.path(v_span, vec![substr.type_ident, ident]);
let e = match os::getenv(var.get()) {
None => {
cx.span_err(sp, msg.get());
- cx.expr_uint(sp, 0)
+ cx.expr_usize(sp, 0)
}
Some(s) => cx.expr_str(sp, token::intern_and_get_ident(&s[]))
};
match c {
parse::CountIs(i) => {
self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIs"),
- vec!(self.ecx.expr_uint(sp, i)))
+ vec!(self.ecx.expr_usize(sp, i)))
}
parse::CountIsParam(i) => {
self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"),
- vec!(self.ecx.expr_uint(sp, i)))
+ vec!(self.ecx.expr_usize(sp, i)))
}
parse::CountImplied => {
let path = self.ecx.path_global(sp, Context::rtpath(self.ecx,
};
let i = i + self.args.len();
self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "CountIsParam"),
- vec!(self.ecx.expr_uint(sp, i)))
+ vec!(self.ecx.expr_usize(sp, i)))
}
}
}
}
parse::ArgumentIs(i) => {
self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"),
- vec!(self.ecx.expr_uint(sp, i)))
+ vec!(self.ecx.expr_usize(sp, i)))
}
// Named arguments are converted to positional arguments at
// the end of the list of arguments
};
let i = i + self.args.len();
self.ecx.expr_call_global(sp, Context::rtpath(self.ecx, "ArgumentIs"),
- vec!(self.ecx.expr_uint(sp, i)))
+ vec!(self.ecx.expr_usize(sp, i)))
}
};
}
};
let align = self.ecx.expr_path(align);
- let flags = self.ecx.expr_uint(sp, arg.format.flags);
+ let flags = self.ecx.expr_usize(sp, arg.format.flags);
let prec = self.trans_count(arg.format.precision);
let width = self.trans_count(arg.format.width);
let path = self.ecx.path_global(sp, Context::rtpath(self.ecx, "FormatSpec"));
assert_eq! (marksof_internal (ans, stopname,&t), vec!(16));}
// rename where stop doesn't match:
{ let chain = vec!(M(9),
- R(id(name1.uint() as u32,
+ R(id(name1.usize() as u32,
apply_mark_internal (4, EMPTY_CTXT,&mut t)),
Name(100101102)),
M(14));
// rename where stop does match
{ let name1sc = apply_mark_internal(4, EMPTY_CTXT, &mut t);
let chain = vec!(M(9),
- R(id(name1.uint() as u32, name1sc),
+ R(id(name1.usize() as u32, name1sc),
stopname),
M(14));
let ans = unfold_test_sc(chain,EMPTY_CTXT,&mut t);
}
token::Literal(token::StrRaw(ident, n), suf) => {
- return mk_lit!("StrRaw", suf, mk_name(cx, sp, ident.ident()), cx.expr_uint(sp, n))
+ return mk_lit!("StrRaw", suf, mk_name(cx, sp, ident.ident()), cx.expr_usize(sp, n))
}
token::Ident(ident, style) => {
let topmost = cx.original_span_in_file();
let loc = cx.codemap().lookup_char_pos(topmost.lo);
- base::MacExpr::new(cx.expr_uint(topmost, loc.line))
+ base::MacExpr::new(cx.expr_usize(topmost, loc.line))
}
/* column!(): expands to the current column number */
let topmost = cx.original_span_in_file();
let loc = cx.codemap().lookup_char_pos(topmost.lo);
- base::MacExpr::new(cx.expr_uint(topmost, loc.col.to_uint()))
+ base::MacExpr::new(cx.expr_usize(topmost, loc.col.to_usize()))
}
/// file!(): expands to the current filename */
noop_fold_ident(i, self)
}
- fn fold_uint(&mut self, i: usize) -> usize {
- noop_fold_uint(i, self)
+ fn fold_usize(&mut self, i: usize) -> usize {
+ noop_fold_usize(i, self)
}
fn fold_path(&mut self, p: Path) -> Path {
i
}
-pub fn noop_fold_uint<T: Folder>(i: usize, _: &mut T) -> usize {
+pub fn noop_fold_usize<T: Folder>(i: usize, _: &mut T) -> usize {
i
}
}
ExprTupField(el, ident) => {
ExprTupField(folder.fold_expr(el),
- respan(ident.span, folder.fold_uint(ident.node)))
+ respan(ident.span, folder.fold_usize(ident.node)))
}
ExprIndex(el, er) => {
ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
/// whitespace. Note k may be outside bounds of s.
fn all_whitespace(s: &str, col: CharPos) -> Option<usize> {
let len = s.len();
- let mut col = col.to_uint();
+ let mut col = col.to_usize();
let mut cursor: usize = 0;
while col > 0 && cursor < len {
let r: str::CharRange = s.char_range_at(cursor);
/// offending string to the error message
fn fatal_span_verbose(&self, from_pos: BytePos, to_pos: BytePos, mut m: String) -> ! {
m.push_str(": ");
- let from = self.byte_offset(from_pos).to_uint();
- let to = self.byte_offset(to_pos).to_uint();
+ let from = self.byte_offset(from_pos).to_usize();
+ let to = self.byte_offset(to_pos).to_usize();
m.push_str(&self.filemap.src[from..to]);
self.fatal_span_(from_pos, to_pos, &m[]);
}
F: FnOnce(&str) -> T,
{
f(self.filemap.src.slice(
- self.byte_offset(start).to_uint(),
- self.byte_offset(end).to_uint()))
+ self.byte_offset(start).to_usize(),
+ self.byte_offset(end).to_usize()))
}
/// Converts CRLF to LF in the given string, raising an error on bare CR.
/// discovered, add it to the FileMap's list of line start offsets.
pub fn bump(&mut self) {
self.last_pos = self.pos;
- let current_byte_offset = self.byte_offset(self.pos).to_uint();
+ let current_byte_offset = self.byte_offset(self.pos).to_usize();
if current_byte_offset < self.filemap.src.len() {
assert!(self.curr.is_some());
let last_char = self.curr.unwrap();
.src
.char_range_at(current_byte_offset);
let byte_offset_diff = next.next - current_byte_offset;
- self.pos = self.pos + Pos::from_uint(byte_offset_diff);
+ self.pos = self.pos + Pos::from_usize(byte_offset_diff);
self.curr = Some(next.ch);
self.col = self.col + CharPos(1u);
if last_char == '\n' {
}
pub fn nextch(&self) -> Option<char> {
- let offset = self.byte_offset(self.pos).to_uint();
+ let offset = self.byte_offset(self.pos).to_usize();
if offset < self.filemap.src.len() {
Some(self.filemap.src.char_at(offset))
} else {
}
pub fn nextnextch(&self) -> Option<char> {
- let offset = self.byte_offset(self.pos).to_uint();
+ let offset = self.byte_offset(self.pos).to_usize();
let s = self.filemap.src.as_slice();
if offset >= s.len() { return None }
let str::CharRange { next, .. } = s.char_range_at(offset);
for &src in srcs.iter() {
let spans = get_spans_of_pat_idents(src);
let Span{ lo, hi, .. } = spans[0];
- assert!("self" == &src[lo.to_uint()..hi.to_uint()],
+ assert!("self" == &src[lo.to_usize()..hi.to_usize()],
"\"{}\" != \"self\". src=\"{}\"",
- &src[lo.to_uint()..hi.to_uint()], src)
+ &src[lo.to_usize()..hi.to_usize()], src)
}
}
// create a fresh mark.
pub fn fresh_mark() -> ast::Mrk {
- gensym("mark").uint() as u32
+ gensym("mark").usize() as u32
}
#[cfg(test)]
ast::ExprTupField(ref expr, id) => {
try!(self.print_expr(&**expr));
try!(word(&mut self.s, "."));
- try!(self.print_uint(id.node));
+ try!(self.print_usize(id.node));
}
ast::ExprIndex(ref expr, ref index) => {
try!(self.print_expr(&**expr));
self.ann.post(self, NodeIdent(&ident))
}
- pub fn print_uint(&mut self, i: usize) -> IoResult<()> {
+ pub fn print_usize(&mut self, i: usize) -> IoResult<()> {
word(&mut self.s, &i.to_string()[])
}
pub fn get(&self, idx: Name) -> T {
let vect = self.vect.borrow();
- (*vect)[idx.uint()].clone()
+ (*vect)[idx.usize()].clone()
}
pub fn len(&self) -> usize {
let new_idx = Name(self.len() as u32);
// leave out of map to avoid colliding
let mut vect = self.vect.borrow_mut();
- let existing = (*vect)[idx.uint()].clone();
+ let existing = (*vect)[idx.usize()].clone();
vect.push(existing);
new_idx
}
pub fn get(&self, idx: Name) -> RcStr {
- (*self.vect.borrow())[idx.uint()].clone()
+ (*self.vect.borrow())[idx.usize()].clone()
}
pub fn len(&self) -> usize {
use syntax::parse::token;
use syntax::ast::{TokenTree, TtToken};
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacExpr};
-use syntax::ext::build::AstBuilder; // trait for expr_uint
+use syntax::ext::build::AstBuilder; // trait for expr_usize
use rustc::plugin::Registry;
// WARNING WARNING WARNING WARNING WARNING
}
}
- MacExpr::new(cx.expr_uint(sp, total))
+ MacExpr::new(cx.expr_usize(sp, total))
}
#[plugin_registrar]