Remove uses of variable name 'res' from rustc
This in preparation of making 'res' a keyword for defining resources. Please don't introduce too many new ones in the meantime...
This commit is contained in:
parent
d507d5fe91
commit
9643aedb04
13 changed files with 320 additions and 330 deletions
|
|
@ -71,11 +71,11 @@ fn parse_ident(@pstate st, str_def sd, char last) -> ast::ident {
|
|||
|
||||
fn parse_ident_(@pstate st, str_def sd, fn(char) -> bool is_last)
|
||||
-> ast::ident {
|
||||
auto res = "";
|
||||
auto rslt = "";
|
||||
while (! is_last(peek(st) as char)) {
|
||||
res += str::unsafe_from_byte(next(st));
|
||||
rslt += str::unsafe_from_byte(next(st));
|
||||
}
|
||||
ret res;
|
||||
ret rslt;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -95,17 +95,17 @@ fn parse_ty_or_bang(@pstate st, str_def sd) -> ty_or_bang {
|
|||
}
|
||||
|
||||
fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
|
||||
let vec[@ty::constr_def] res = [];
|
||||
let vec[@ty::constr_def] rslt = [];
|
||||
alt (peek(st) as char) {
|
||||
case (':') {
|
||||
do {
|
||||
auto ignore = next(st);
|
||||
vec::push(res, parse_constr(st, sd));
|
||||
vec::push(rslt, parse_constr(st, sd));
|
||||
} while (peek(st) as char == ';')
|
||||
}
|
||||
case (_) { }
|
||||
}
|
||||
ret res;
|
||||
ret rslt;
|
||||
}
|
||||
|
||||
fn parse_path(@pstate st, str_def sd) -> ast::path {
|
||||
|
|
@ -370,8 +370,7 @@ fn parse_ty_fn(@pstate st, str_def sd) ->
|
|||
}
|
||||
st.pos += 1u; // eat the ']'
|
||||
auto cs = parse_constrs(st, sd);
|
||||
auto res = parse_ty_or_bang(st, sd);
|
||||
alt (res) {
|
||||
alt (parse_ty_or_bang(st, sd)) {
|
||||
case (a_bang) {
|
||||
ret tup(inputs, ty::mk_bot(st.tcx), ast::noreturn, cs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,31 +158,31 @@ fn digits_to_string(str s) -> int {
|
|||
|
||||
fn scan_exponent(&reader rdr) -> option::t[str] {
|
||||
auto c = rdr.curr();
|
||||
auto res = "";
|
||||
auto rslt = "";
|
||||
if (c == 'e' || c == 'E') {
|
||||
res += str::from_bytes([c as u8]);
|
||||
rslt += str::from_bytes([c as u8]);
|
||||
rdr.bump();
|
||||
c = rdr.curr();
|
||||
if (c == '-' || c == '+') {
|
||||
res += str::from_bytes([c as u8]);
|
||||
rslt += str::from_bytes([c as u8]);
|
||||
rdr.bump();
|
||||
}
|
||||
auto exponent = scan_dec_digits(rdr);
|
||||
if (str::byte_len(exponent) > 0u) {
|
||||
ret some(res + exponent);
|
||||
ret some(rslt + exponent);
|
||||
} else { rdr.err("scan_exponent: bad fp literal"); fail; }
|
||||
} else { ret none[str]; }
|
||||
}
|
||||
|
||||
fn scan_dec_digits(&reader rdr) -> str {
|
||||
auto c = rdr.curr();
|
||||
let str res = "";
|
||||
let str rslt = "";
|
||||
while (is_dec_digit(c) || c == '_') {
|
||||
if (c != '_') { res += str::from_bytes([c as u8]); }
|
||||
if (c != '_') { rslt += str::from_bytes([c as u8]); }
|
||||
rdr.bump();
|
||||
c = rdr.curr();
|
||||
}
|
||||
ret res;
|
||||
ret rslt;
|
||||
}
|
||||
|
||||
fn scan_number(char c, &reader rdr) -> token::token {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ fn new_parser(session::session sess, eval::env env,
|
|||
mutable uint lo,
|
||||
mutable uint hi,
|
||||
mutable uint last_lo,
|
||||
mutable restriction res,
|
||||
mutable restriction restr,
|
||||
lexer::reader rdr,
|
||||
vec[op_spec] precs,
|
||||
mutable ast::node_id next_id_var,
|
||||
|
|
@ -75,8 +75,8 @@ fn new_parser(session::session sess, eval::env env,
|
|||
hi = rdr.get_chpos();
|
||||
}
|
||||
fn fatal(str m) -> ! { sess.span_fatal(rec(lo=lo, hi=hi), m); }
|
||||
fn restrict(restriction r) { res = r; }
|
||||
fn get_restriction() -> restriction { ret res; }
|
||||
fn restrict(restriction r) { restr = r; }
|
||||
fn get_restriction() -> restriction { ret restr; }
|
||||
fn get_session() -> session::session { ret sess; }
|
||||
fn get_span() -> common::span { ret rec(lo=lo, hi=hi); }
|
||||
fn get_lo_pos() -> uint { ret lo; }
|
||||
|
|
@ -1653,15 +1653,15 @@ fn parse_fn_decl(&parser p, ast::purity purity) -> ast::fn_decl {
|
|||
let util::common::spanned[vec[ast::arg]] inputs =
|
||||
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA), parse_arg,
|
||||
p);
|
||||
let ty_or_bang res;
|
||||
let ty_or_bang rslt;
|
||||
auto constrs = parse_constrs(inputs.node, p).node;
|
||||
if (p.peek() == token::RARROW) {
|
||||
p.bump();
|
||||
res = parse_ty_or_bang(p);
|
||||
rslt = parse_ty_or_bang(p);
|
||||
} else {
|
||||
res = a_ty(@spanned(inputs.span.lo, inputs.span.hi, ast::ty_nil));
|
||||
rslt = a_ty(@spanned(inputs.span.lo, inputs.span.hi, ast::ty_nil));
|
||||
}
|
||||
alt (res) {
|
||||
alt (rslt) {
|
||||
case (a_ty(?t)) {
|
||||
ret rec(inputs=inputs.node,
|
||||
output=t,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue