syntax: Rename expr_alt to expr_match

This commit is contained in:
Brian Anderson 2012-08-07 13:35:51 -07:00
parent 92ef17aaeb
commit bc267c696c
19 changed files with 25 additions and 25 deletions

View File

@ -70,7 +70,7 @@ pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool {
// parenthesizing!! See email to marijn.
ast::expr_if(_, _, _) => { false }
ast::expr_block(_) => { false }
ast::expr_alt(_, _, _) => { false }
ast::expr_match(_, _, _) => { false }
ast::expr_while(_, _) => { false }
// https://github.com/mozilla/rust/issues/929

View File

@ -316,7 +316,7 @@ enum expr_ {
Same semantics as while(true) { body }, but typestate knows that the
(implicit) condition is always true. */
expr_loop(blk),
expr_alt(@expr, ~[arm], alt_mode),
expr_match(@expr, ~[arm], alt_mode),
expr_fn(proto, fn_decl, blk, capture_clause),
expr_fn_block(fn_decl, blk, capture_clause),
// Inner expr is always an expr_fn_block. We need the wrapping node to

View File

@ -246,7 +246,7 @@ impl helpers of ext_ctxt_helpers for ext_ctxt {
self.stmt(
self.expr(
span,
ast::expr_alt(v, arms, ast::alt_exhaustive)))
ast::expr_match(v, arms, ast::alt_exhaustive)))
}
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,
// Generate code like:
let e_name = cx.lit_str(e_span, e_name);
let alt_expr = cx.expr(e_span,
ast::expr_alt(#ast{__i}, arms, ast::alt_check));
ast::expr_match(#ast{__i}, arms, ast::alt_check));
let var_lambda = #ast{ |__i| $(alt_expr) };
let read_var = #ast{ $(cx.clone(d)).read_enum_variant($(var_lambda)) };
let read_lambda = cx.lambda(cx.expr_blk(read_var));

View File

@ -441,8 +441,8 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ {
expr_loop(body) => {
expr_loop(fld.fold_block(body))
}
expr_alt(expr, arms, mode) => {
expr_alt(fld.fold_expr(expr),
expr_match(expr, arms, mode) => {
expr_match(fld.fold_expr(expr),
vec::map(arms, |x| fld.fold_arm(x)), mode)
}
expr_fn(proto, decl, body, captures) => {

View File

@ -6,7 +6,7 @@ import ast_util::operator_prec;
fn expr_requires_semi_to_be_stmt(e: @ast::expr) -> bool {
match e.node {
ast::expr_if(_, _, _) | ast::expr_alt(_, _, _) | ast::expr_block(_)
ast::expr_if(_, _, _) | ast::expr_match(_, _, _) | ast::expr_block(_)
| ast::expr_while(_, _) | ast::expr_loop(_)
| ast::expr_call(_, _, true) => false,
_ => true

View File

@ -24,7 +24,7 @@ import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute,
cdir_view_item, class_immutable, class_member, class_method,
class_mutable, crate, crate_cfg, crate_directive, decl,
decl_item, decl_local, default_blk, deref, div, expl, expr,
expr_, expr_addr_of, expr_alt, expr_again, expr_assert,
expr_, expr_addr_of, expr_match, expr_again, expr_assert,
expr_assign, expr_assign_op, expr_binary, expr_block, expr_break,
expr_call, expr_cast, expr_copy, expr_do_body,
expr_fail, expr_field, expr_fn, expr_fn_block, expr_if,
@ -1599,7 +1599,7 @@ class parser {
}
let mut hi = self.span.hi;
self.bump();
return self.mk_expr(lo, hi, expr_alt(discriminant, arms, mode));
return self.mk_expr(lo, hi, expr_match(discriminant, arms, mode));
}
fn parse_expr() -> @expr {

View File

@ -1076,7 +1076,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
space(s.s);
print_block(s, blk);
}
ast::expr_alt(expr, arms, mode) => {
ast::expr_match(expr, arms, mode) => {
cbox(s, alt_indent_unit);
ibox(s, 4u);
word_nbsp(s, ~"match");

View File

@ -400,7 +400,7 @@ fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
}
expr_while(x, b) => { v.visit_expr(x, e, v); v.visit_block(b, e, v); }
expr_loop(b) => v.visit_block(b, e, v),
expr_alt(x, arms, _) => {
expr_match(x, arms, _) => {
v.visit_expr(x, e, v);
for arms.each |a| { v.visit_arm(a, e, v); }
}

View File

@ -177,7 +177,7 @@ impl public_methods for borrowck_ctxt {
ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) |
ast::expr_if(*) | ast::expr_log(*) |
ast::expr_binary(*) | ast::expr_while(*) |
ast::expr_block(*) | ast::expr_loop(*) | ast::expr_alt(*) |
ast::expr_block(*) | ast::expr_loop(*) | ast::expr_match(*) |
ast::expr_lit(*) | ast::expr_break | ast::expr_mac(*) |
ast::expr_again | ast::expr_rec(*) | ast::expr_struct(*) |
ast::expr_unary_move(*) | ast::expr_repeat(*) => {

View File

@ -171,7 +171,7 @@ fn req_loans_in_expr(ex: @ast::expr,
visit::visit_expr(ex, self, vt);
}
ast::expr_alt(ex_v, arms, _) => {
ast::expr_match(ex_v, arms, _) => {
let cmt = self.bccx.cat_expr(ex_v);
for arms.each |arm| {
for arm.pats.each |pat| {

View File

@ -23,7 +23,7 @@ fn check_crate(tcx: ty::ctxt, crate: @crate) {
fn check_expr(tcx: ty::ctxt, ex: @expr, &&s: (), v: visit::vt<()>) {
visit::visit_expr(ex, s, v);
match ex.node {
expr_alt(scrut, arms, mode) => {
expr_match(scrut, arms, mode) => {
check_arms(tcx, arms);
/* Check for exhaustiveness */
// Check for empty enum, because is_useful only works on inhabited

View File

@ -453,7 +453,7 @@ fn visit_expr(expr: @expr, &&self: @ir_maps, vt: vt<@ir_maps>) {
}
// live nodes required for interesting control flow:
expr_if(*) | expr_alt(*) | expr_while(*) | expr_loop(*) => {
expr_if(*) | expr_match(*) | expr_while(*) | expr_loop(*) => {
(*self).add_live_node_for_node(expr.id, lnk_expr(expr.span));
visit::visit_expr(expr, self, vt);
}
@ -966,7 +966,7 @@ class liveness {
self.propagate_through_loop(expr, none, blk, succ)
}
expr_alt(e, arms, _) => {
expr_match(e, arms, _) => {
//
// (e)
// |
@ -1449,7 +1449,7 @@ fn check_expr(expr: @expr, &&self: @liveness, vt: vt<@liveness>) {
}
// no correctness conditions related to liveness
expr_if(*) | expr_alt(*) |
expr_if(*) | expr_match(*) |
expr_while(*) | expr_loop(*) |
expr_index(*) | expr_field(*) | expr_vstore(*) |
expr_vec(*) | expr_rec(*) | expr_tup(*) |

View File

@ -237,7 +237,7 @@ fn resolve_expr(expr: @ast::expr, cx: ctxt, visitor: visit::vt<ctxt>) {
debug!{"node %d: %s", expr.id, pprust::expr_to_str(expr)};
new_cx.parent = some(expr.id);
}
ast::expr_alt(subexpr, _, _) => {
ast::expr_match(subexpr, _, _) => {
debug!{"node %d: %s", expr.id, pprust::expr_to_str(expr)};
new_cx.parent = some(expr.id);
}

View File

@ -3665,7 +3665,7 @@ fn trans_expr(bcx: block, e: @ast::expr, dest: dest) -> block {
ast::expr_if(cond, thn, els) => {
return trans_if(bcx, cond, thn, els, dest);
}
ast::expr_alt(expr, arms, mode) => {
ast::expr_match(expr, arms, mode) => {
return alt::trans_alt(bcx, e, expr, arms, mode, dest);
}
ast::expr_block(blk) => {

View File

@ -243,7 +243,7 @@ fn mark_for_expr(cx: ctx, e: @expr) {
}
})
}
expr_alt(_, _, _) | expr_block(_) | expr_if(_, _, _) |
expr_match(_, _, _) | expr_block(_) | expr_if(_, _, _) |
expr_while(_, _) | expr_fail(_) | expr_break | expr_again |
expr_unary(_, _) | expr_lit(_) | expr_assert(_) |
expr_mac(_) | expr_addr_of(_, _) |

View File

@ -388,7 +388,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) {
loop_postcond);
}
expr_index(val, sub) { find_pre_post_exprs(fcx, ~[val, sub], e.id); }
expr_alt(ex, alts, _) {
expr_match(ex, alts, _) {
find_pre_post_expr(fcx, ex);
fn do_an_alt(fcx: fn_ctxt, an_alt: arm) -> pre_and_post {
match an_alt.guard {

View File

@ -443,7 +443,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool {
expr_index(val, sub) {
return find_pre_post_state_two(fcx, pres, val, sub, e.id, oper_pure);
}
expr_alt(val, alts, _) {
expr_match(val, alts, _) {
let mut changed =
set_prestate_ann(fcx.ccx, e.id, pres) |
find_pre_post_state_expr(fcx, pres, val);

View File

@ -1472,7 +1472,7 @@ fn check_expr_with_unifier(fcx: @fn_ctxt,
fcx.write_ty(id, ty::mk_nil(tcx));
bot = !may_break(body);
}
ast::expr_alt(discrim, arms, _) => {
ast::expr_match(discrim, arms, _) => {
bot = alt::check_alt(fcx, expr, discrim, arms);
}
ast::expr_fn(proto, decl, body, cap_clause) => {

View File

@ -34,7 +34,7 @@ fn explain_region(cx: ctxt, region: ty::region) -> ~str {
some(ast_map::node_expr(expr)) => {
match expr.node {
ast::expr_call(*) => { explain_span(cx, ~"call", expr.span) }
ast::expr_alt(*) => { explain_span(cx, ~"alt", expr.span) }
ast::expr_match(*) => { explain_span(cx, ~"alt", expr.span) }
_ => { explain_span(cx, ~"expression", expr.span) }
}
}
@ -106,7 +106,7 @@ fn re_scope_id_to_str(cx: ctxt, node_id: ast::node_id) -> ~str {
fmt!{"<call at %s>",
codemap::span_to_str(expr.span, cx.sess.codemap)}
}
ast::expr_alt(*) => {
ast::expr_match(*) => {
fmt!{"<alt at %s>",
codemap::span_to_str(expr.span, cx.sess.codemap)}
}