Skip to content

Commit 9643aed

Browse files
committed
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...
1 parent d507d5f commit 9643aed

File tree

13 files changed

+321
-331
lines changed

13 files changed

+321
-331
lines changed

src/comp/front/creader.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ fn parse_ident(@pstate st, str_def sd, char last) -> ast::ident {
7171

7272
fn parse_ident_(@pstate st, str_def sd, fn(char) -> bool is_last)
7373
-> ast::ident {
74-
auto res = "";
74+
auto rslt = "";
7575
while (! is_last(peek(st) as char)) {
76-
res += str::unsafe_from_byte(next(st));
76+
rslt += str::unsafe_from_byte(next(st));
7777
}
78-
ret res;
78+
ret rslt;
7979
}
8080

8181

@@ -95,17 +95,17 @@ fn parse_ty_or_bang(@pstate st, str_def sd) -> ty_or_bang {
9595
}
9696

9797
fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
98-
let vec[@ty::constr_def] res = [];
98+
let vec[@ty::constr_def] rslt = [];
9999
alt (peek(st) as char) {
100100
case (':') {
101101
do {
102102
auto ignore = next(st);
103-
vec::push(res, parse_constr(st, sd));
103+
vec::push(rslt, parse_constr(st, sd));
104104
} while (peek(st) as char == ';')
105105
}
106106
case (_) { }
107107
}
108-
ret res;
108+
ret rslt;
109109
}
110110

111111
fn parse_path(@pstate st, str_def sd) -> ast::path {
@@ -370,8 +370,7 @@ fn parse_ty_fn(@pstate st, str_def sd) ->
370370
}
371371
st.pos += 1u; // eat the ']'
372372
auto cs = parse_constrs(st, sd);
373-
auto res = parse_ty_or_bang(st, sd);
374-
alt (res) {
373+
alt (parse_ty_or_bang(st, sd)) {
375374
case (a_bang) {
376375
ret tup(inputs, ty::mk_bot(st.tcx), ast::noreturn, cs);
377376
}

src/comp/front/lexer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,31 +158,31 @@ fn digits_to_string(str s) -> int {
158158

159159
fn scan_exponent(&reader rdr) -> option::t[str] {
160160
auto c = rdr.curr();
161-
auto res = "";
161+
auto rslt = "";
162162
if (c == 'e' || c == 'E') {
163-
res += str::from_bytes([c as u8]);
163+
rslt += str::from_bytes([c as u8]);
164164
rdr.bump();
165165
c = rdr.curr();
166166
if (c == '-' || c == '+') {
167-
res += str::from_bytes([c as u8]);
167+
rslt += str::from_bytes([c as u8]);
168168
rdr.bump();
169169
}
170170
auto exponent = scan_dec_digits(rdr);
171171
if (str::byte_len(exponent) > 0u) {
172-
ret some(res + exponent);
172+
ret some(rslt + exponent);
173173
} else { rdr.err("scan_exponent: bad fp literal"); fail; }
174174
} else { ret none[str]; }
175175
}
176176

177177
fn scan_dec_digits(&reader rdr) -> str {
178178
auto c = rdr.curr();
179-
let str res = "";
179+
let str rslt = "";
180180
while (is_dec_digit(c) || c == '_') {
181-
if (c != '_') { res += str::from_bytes([c as u8]); }
181+
if (c != '_') { rslt += str::from_bytes([c as u8]); }
182182
rdr.bump();
183183
c = rdr.curr();
184184
}
185-
ret res;
185+
ret rslt;
186186
}
187187

188188
fn scan_number(char c, &reader rdr) -> token::token {

src/comp/front/parser.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn new_parser(session::session sess, eval::env env,
5858
mutable uint lo,
5959
mutable uint hi,
6060
mutable uint last_lo,
61-
mutable restriction res,
61+
mutable restriction restr,
6262
lexer::reader rdr,
6363
vec[op_spec] precs,
6464
mutable ast::node_id next_id_var,
@@ -75,8 +75,8 @@ fn new_parser(session::session sess, eval::env env,
7575
hi = rdr.get_chpos();
7676
}
7777
fn fatal(str m) -> ! { sess.span_fatal(rec(lo=lo, hi=hi), m); }
78-
fn restrict(restriction r) { res = r; }
79-
fn get_restriction() -> restriction { ret res; }
78+
fn restrict(restriction r) { restr = r; }
79+
fn get_restriction() -> restriction { ret restr; }
8080
fn get_session() -> session::session { ret sess; }
8181
fn get_span() -> common::span { ret rec(lo=lo, hi=hi); }
8282
fn get_lo_pos() -> uint { ret lo; }
@@ -1653,15 +1653,15 @@ fn parse_fn_decl(&parser p, ast::purity purity) -> ast::fn_decl {
16531653
let util::common::spanned[vec[ast::arg]] inputs =
16541654
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA), parse_arg,
16551655
p);
1656-
let ty_or_bang res;
1656+
let ty_or_bang rslt;
16571657
auto constrs = parse_constrs(inputs.node, p).node;
16581658
if (p.peek() == token::RARROW) {
16591659
p.bump();
1660-
res = parse_ty_or_bang(p);
1660+
rslt = parse_ty_or_bang(p);
16611661
} else {
1662-
res = a_ty(@spanned(inputs.span.lo, inputs.span.hi, ast::ty_nil));
1662+
rslt = a_ty(@spanned(inputs.span.lo, inputs.span.hi, ast::ty_nil));
16631663
}
1664-
alt (res) {
1664+
alt (rslt) {
16651665
case (a_ty(?t)) {
16661666
ret rec(inputs=inputs.node,
16671667
output=t,

0 commit comments

Comments
 (0)