Skip to content

Commit bc267c6

Browse files
committed
syntax: Rename expr_alt to expr_match
1 parent 92ef17a commit bc267c6

File tree

19 files changed

+25
-25
lines changed

19 files changed

+25
-25
lines changed

src/fuzzer/fuzzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool {
7070
// parenthesizing!! See email to marijn.
7171
ast::expr_if(_, _, _) => { false }
7272
ast::expr_block(_) => { false }
73-
ast::expr_alt(_, _, _) => { false }
73+
ast::expr_match(_, _, _) => { false }
7474
ast::expr_while(_, _) => { false }
7575

7676
// https://github.com/mozilla/rust/issues/929

src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ enum expr_ {
316316
Same semantics as while(true) { body }, but typestate knows that the
317317
(implicit) condition is always true. */
318318
expr_loop(blk),
319-
expr_alt(@expr, ~[arm], alt_mode),
319+
expr_match(@expr, ~[arm], alt_mode),
320320
expr_fn(proto, fn_decl, blk, capture_clause),
321321
expr_fn_block(fn_decl, blk, capture_clause),
322322
// Inner expr is always an expr_fn_block. We need the wrapping node to

src/libsyntax/ext/auto_serialize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl helpers of ext_ctxt_helpers for ext_ctxt {
246246
self.stmt(
247247
self.expr(
248248
span,
249-
ast::expr_alt(v, arms, ast::alt_exhaustive)))
249+
ast::expr_match(v, arms, ast::alt_exhaustive)))
250250
}
251251

252252
fn lit_str(span: span, s: @~str) -> @ast::expr {
@@ -910,7 +910,7 @@ fn deser_enum(cx: ext_ctxt, tps: deser_tps_map, e_name: ast::ident,
910910
// Generate code like:
911911
let e_name = cx.lit_str(e_span, e_name);
912912
let alt_expr = cx.expr(e_span,
913-
ast::expr_alt(#ast{__i}, arms, ast::alt_check));
913+
ast::expr_match(#ast{__i}, arms, ast::alt_check));
914914
let var_lambda = #ast{ |__i| $(alt_expr) };
915915
let read_var = #ast{ $(cx.clone(d)).read_enum_variant($(var_lambda)) };
916916
let read_lambda = cx.lambda(cx.expr_blk(read_var));

src/libsyntax/fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,8 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
441441
expr_loop(body) => {
442442
expr_loop(fld.fold_block(body))
443443
}
444-
expr_alt(expr, arms, mode) => {
445-
expr_alt(fld.fold_expr(expr),
444+
expr_match(expr, arms, mode) => {
445+
expr_match(fld.fold_expr(expr),
446446
vec::map(arms, |x| fld.fold_arm(x)), mode)
447447
}
448448
expr_fn(proto, decl, body, captures) => {

src/libsyntax/parse/classify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ast_util::operator_prec;
66

77
fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
88
match e.node {
9-
ast::expr_if(_, _, _) | ast::expr_alt(_, _, _) | ast::expr_block(_)
9+
ast::expr_if(_, _, _) | ast::expr_match(_, _, _) | ast::expr_block(_)
1010
| ast::expr_while(_, _) | ast::expr_loop(_)
1111
| ast::expr_call(_, _, true) => false,
1212
_ => true

src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
2424
cdir_view_item, class_immutable, class_member, class_method,
2525
class_mutable, crate, crate_cfg, crate_directive, decl,
2626
decl_item, decl_local, default_blk, deref, div, expl, expr,
27-
expr_, expr_addr_of, expr_alt, expr_again, expr_assert,
27+
expr_, expr_addr_of, expr_match, expr_again, expr_assert,
2828
expr_assign, expr_assign_op, expr_binary, expr_block, expr_break,
2929
expr_call, expr_cast, expr_copy, expr_do_body,
3030
expr_fail, expr_field, expr_fn, expr_fn_block, expr_if,
@@ -1599,7 +1599,7 @@ class parser {
15991599
}
16001600
let mut hi = self.span.hi;
16011601
self.bump();
1602-
return self.mk_expr(lo, hi, expr_alt(discriminant, arms, mode));
1602+
return self.mk_expr(lo, hi, expr_match(discriminant, arms, mode));
16031603
}
16041604
16051605
fn parse_expr() -> @expr {

src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
10761076
space(s.s);
10771077
print_block(s, blk);
10781078
}
1079-
ast::expr_alt(expr, arms, mode) => {
1079+
ast::expr_match(expr, arms, mode) => {
10801080
cbox(s, alt_indent_unit);
10811081
ibox(s, 4u);
10821082
word_nbsp(s, ~"match");

src/libsyntax/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
400400
}
401401
expr_while(x, b) => { v.visit_expr(x, e, v); v.visit_block(b, e, v); }
402402
expr_loop(b) => v.visit_block(b, e, v),
403-
expr_alt(x, arms, _) => {
403+
expr_match(x, arms, _) => {
404404
v.visit_expr(x, e, v);
405405
for arms.each |a| { v.visit_arm(a, e, v); }
406406
}

src/rustc/middle/borrowck/categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl public_methods for borrowck_ctxt {
177177
ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) |
178178
ast::expr_if(*) | ast::expr_log(*) |
179179
ast::expr_binary(*) | ast::expr_while(*) |
180-
ast::expr_block(*) | ast::expr_loop(*) | ast::expr_alt(*) |
180+
ast::expr_block(*) | ast::expr_loop(*) | ast::expr_match(*) |
181181
ast::expr_lit(*) | ast::expr_break | ast::expr_mac(*) |
182182
ast::expr_again | ast::expr_rec(*) | ast::expr_struct(*) |
183183
ast::expr_unary_move(*) | ast::expr_repeat(*) => {

src/rustc/middle/borrowck/gather_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ fn req_loans_in_expr(ex: @ast::expr,
171171
visit::visit_expr(ex, self, vt);
172172
}
173173

174-
ast::expr_alt(ex_v, arms, _) => {
174+
ast::expr_match(ex_v, arms, _) => {
175175
let cmt = self.bccx.cat_expr(ex_v);
176176
for arms.each |arm| {
177177
for arm.pats.each |pat| {

src/rustc/middle/check_alt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
2323
fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
2424
visit::visit_expr(ex, s, v);
2525
match ex.node {
26-
expr_alt(scrut, arms, mode) => {
26+
expr_match(scrut, arms, mode) => {
2727
check_arms(tcx, arms);
2828
/* Check for exhaustiveness */
2929
// Check for empty enum, because is_useful only works on inhabited

src/rustc/middle/liveness.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) {
453453
}
454454

455455
// live nodes required for interesting control flow:
456-
expr_if(*) | expr_alt(*) | expr_while(*) | expr_loop(*) => {
456+
expr_if(*) | expr_match(*) | expr_while(*) | expr_loop(*) => {
457457
(*self).add_live_node_for_node(expr.id, lnk_expr(expr.span));
458458
visit::visit_expr(expr, self, vt);
459459
}
@@ -966,7 +966,7 @@ class liveness {
966966
self.propagate_through_loop(expr, none, blk, succ)
967967
}
968968

969-
expr_alt(e, arms, _) => {
969+
expr_match(e, arms, _) => {
970970
//
971971
// (e)
972972
// |
@@ -1449,7 +1449,7 @@ fn check_expr(expr: @expr, &&self: @liveness, vt: vt<@liveness>) {
14491449
}
14501450

14511451
// no correctness conditions related to liveness
1452-
expr_if(*) | expr_alt(*) |
1452+
expr_if(*) | expr_match(*) |
14531453
expr_while(*) | expr_loop(*) |
14541454
expr_index(*) | expr_field(*) | expr_vstore(*) |
14551455
expr_vec(*) | expr_rec(*) | expr_tup(*) |

src/rustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
237237
debug!{"node %d: %s", expr.id, pprust::expr_to_str(expr)};
238238
new_cx.parent = some(expr.id);
239239
}
240-
ast::expr_alt(subexpr, _, _) => {
240+
ast::expr_match(subexpr, _, _) => {
241241
debug!{"node %d: %s", expr.id, pprust::expr_to_str(expr)};
242242
new_cx.parent = some(expr.id);
243243
}

src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3665,7 +3665,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
36653665
ast::expr_if(cond, thn, els) => {
36663666
return trans_if(bcx, cond, thn, els, dest);
36673667
}
3668-
ast::expr_alt(expr, arms, mode) => {
3668+
ast::expr_match(expr, arms, mode) => {
36693669
return alt::trans_alt(bcx, e, expr, arms, mode, dest);
36703670
}
36713671
ast::expr_block(blk) => {

src/rustc/middle/trans/type_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
243243
}
244244
})
245245
}
246-
expr_alt(_, _, _) | expr_block(_) | expr_if(_, _, _) |
246+
expr_match(_, _, _) | expr_block(_) | expr_if(_, _, _) |
247247
expr_while(_, _) | expr_fail(_) | expr_break | expr_again |
248248
expr_unary(_, _) | expr_lit(_) | expr_assert(_) |
249249
expr_mac(_) | expr_addr_of(_, _) |

src/rustc/middle/tstate/pre_post_conditions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
388388
loop_postcond);
389389
}
390390
expr_index(val, sub) { find_pre_post_exprs(fcx, ~[val, sub], e.id); }
391-
expr_alt(ex, alts, _) {
391+
expr_match(ex, alts, _) {
392392
find_pre_post_expr(fcx, ex);
393393
fn do_an_alt(fcx: fn_ctxt, an_alt: arm) -> pre_and_post {
394394
match an_alt.guard {

src/rustc/middle/tstate/states.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
443443
expr_index(val, sub) {
444444
return find_pre_post_state_two(fcx, pres, val, sub, e.id, oper_pure);
445445
}
446-
expr_alt(val, alts, _) {
446+
expr_match(val, alts, _) {
447447
let mut changed =
448448
set_prestate_ann(fcx.ccx, e.id, pres) |
449449
find_pre_post_state_expr(fcx, pres, val);

src/rustc/middle/typeck/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
14721472
fcx.write_ty(id, ty::mk_nil(tcx));
14731473
bot = !may_break(body);
14741474
}
1475-
ast::expr_alt(discrim, arms, _) => {
1475+
ast::expr_match(discrim, arms, _) => {
14761476
bot = alt::check_alt(fcx, expr, discrim, arms);
14771477
}
14781478
ast::expr_fn(proto, decl, body, cap_clause) => {

src/rustc/util/ppaux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn explain_region(cx: ctxt, region: ty::region) -> ~str {
3434
some(ast_map::node_expr(expr)) => {
3535
match expr.node {
3636
ast::expr_call(*) => { explain_span(cx, ~"call", expr.span) }
37-
ast::expr_alt(*) => { explain_span(cx, ~"alt", expr.span) }
37+
ast::expr_match(*) => { explain_span(cx, ~"alt", expr.span) }
3838
_ => { explain_span(cx, ~"expression", expr.span) }
3939
}
4040
}
@@ -106,7 +106,7 @@ fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
106106
fmt!{"<call at %s>",
107107
codemap::span_to_str(expr.span, cx.sess.codemap)}
108108
}
109-
ast::expr_alt(*) => {
109+
ast::expr_match(*) => {
110110
fmt!{"<alt at %s>",
111111
codemap::span_to_str(expr.span, cx.sess.codemap)}
112112
}

0 commit comments

Comments
 (0)