Skip to content

Rename tydecode::parse_int to parse_uint #5811

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ fn parse_vstore(st: @mut PState) -> ty::vstore {

let c = peek(st);
if '0' <= c && c <= '9' {
let n = parse_int(st) as uint;
let n = parse_uint(st);
assert!(next(st) == '|');
return ty::vstore_fixed(n);
}
Expand Down Expand Up @@ -214,13 +214,13 @@ fn parse_bound_region(st: @mut PState) -> ty::bound_region {
match next(st) {
's' => ty::br_self,
'a' => {
let id = parse_int(st) as uint;
let id = parse_uint(st);
assert!(next(st) == '|');
ty::br_anon(id)
}
'[' => ty::br_named(st.tcx.sess.ident_of(parse_str(st, ']'))),
'c' => {
let id = parse_int(st);
let id = parse_uint(st) as int;
assert!(next(st) == '|');
ty::br_cap_avoid(id, @parse_bound_region(st))
},
Expand All @@ -235,14 +235,14 @@ fn parse_region(st: @mut PState) -> ty::Region {
}
'f' => {
assert!(next(st) == '[');
let id = parse_int(st);
let id = parse_uint(st) as int;
assert!(next(st) == '|');
let br = parse_bound_region(st);
assert!(next(st) == ']');
ty::re_free(id, br)
}
's' => {
let id = parse_int(st);
let id = parse_uint(st) as int;
assert!(next(st) == '|');
ty::re_scope(id)
}
Expand Down Expand Up @@ -318,7 +318,7 @@ fn parse_ty(st: @mut PState, conv: conv_did) -> ty::t {
'p' => {
let did = parse_def(st, TypeParameter, conv);
debug!("parsed ty_param: did=%?", did);
return ty::mk_param(st.tcx, parse_int(st) as uint, did);
return ty::mk_param(st.tcx, parse_uint(st), did);
}
's' => {
let did = parse_def(st, TypeParameter, conv);
Expand Down Expand Up @@ -413,14 +413,14 @@ fn parse_def(st: @mut PState, source: DefIdSource,
return conv(source, parse_def_id(def));
}

fn parse_int(st: @mut PState) -> int {
fn parse_uint(st: @mut PState) -> uint {
let mut n = 0;
loop {
let cur = peek(st);
if cur < '0' || cur > '9' { return n; }
st.pos = st.pos + 1u;
n *= 10;
n += (cur as int) - ('0' as int);
n += (cur as uint) - ('0' as uint);
};
}

Expand Down