diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-18 22:37:22 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-18 23:17:34 -0800 |
| commit | 04a2887f8791bb080b4e76a55949a7c1954dbb97 (patch) | |
| tree | f072b2cc1e0b41270041a3a10a4fc313d3fa1a89 /src/comp/middle/tstate | |
| parent | ca7cfbe3d0251766217e5d4e559903e655e7549b (diff) | |
| download | rust-04a2887f8791bb080b4e76a55949a7c1954dbb97.tar.gz rust-04a2887f8791bb080b4e76a55949a7c1954dbb97.zip | |
Remove '.' after nullary tags in patterns
Does what it says on the tin. The next commit will remove support for this syntax.
Diffstat (limited to 'src/comp/middle/tstate')
| -rw-r--r-- | src/comp/middle/tstate/ann.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/tstate/auxiliary.rs | 28 | ||||
| -rw-r--r-- | src/comp/middle/tstate/bitvectors.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/tstate/collect_locals.rs | 2 | ||||
| -rw-r--r-- | src/comp/middle/tstate/pre_post_conditions.rs | 34 | ||||
| -rw-r--r-- | src/comp/middle/tstate/states.rs | 34 | ||||
| -rw-r--r-- | src/comp/middle/tstate/tritv.rs | 52 |
7 files changed, 77 insertions, 77 deletions
diff --git a/src/comp/middle/tstate/ann.rs b/src/comp/middle/tstate/ann.rs index 18fe58ae8ee..f3862e3d20f 100644 --- a/src/comp/middle/tstate/ann.rs +++ b/src/comp/middle/tstate/ann.rs @@ -240,7 +240,7 @@ fn implies(a: t, b: t) -> bool { } fn trit_str(t: trit) -> str { - alt t { dont_care. { "?" } ttrue. { "1" } tfalse. { "0" } } + alt t { dont_care { "?" } ttrue { "1" } tfalse { "0" } } } // // Local Variables: diff --git a/src/comp/middle/tstate/auxiliary.rs b/src/comp/middle/tstate/auxiliary.rs index cb592be250c..04469cda4eb 100644 --- a/src/comp/middle/tstate/auxiliary.rs +++ b/src/comp/middle/tstate/auxiliary.rs @@ -41,7 +41,7 @@ fn comma_str(args: [@constr_arg_use]) -> str { for a: @constr_arg_use in args { if comma { rslt += ", "; } else { comma = true; } alt a.node { - carg_base. { rslt += "*"; } + carg_base { rslt += "*"; } carg_ident(i) { rslt += i.ident; } carg_lit(l) { rslt += lit_to_str(l); } } @@ -69,7 +69,7 @@ fn tritv_to_str(fcx: fn_ctxt, v: tritv::t) -> str { let comma = false; for p: norm_constraint in constraints(fcx) { alt tritv_get(v, p.bit_num) { - dont_care. { } + dont_care { } tt { s += if comma { ", " } else { comma = true; "" } + @@ -310,7 +310,7 @@ fn get_ts_ann(ccx: crate_ctxt, i: node_id) -> option::t<ts_ann> { /********* utils ********/ fn node_id_to_ts_ann(ccx: crate_ctxt, id: node_id) -> ts_ann { alt get_ts_ann(ccx, id) { - none. { + none { #error("node_id_to_ts_ann: no ts_ann for node_id %d", id); fail; } @@ -507,7 +507,7 @@ fn constraints_expr(cx: ty::ctxt, e: @expr) -> [@ty::constr] { fn node_id_to_def_strict(cx: ty::ctxt, id: node_id) -> def { alt cx.def_map.find(id) { - none. { + none { #error("node_id_to_def: node_id %d has no def", id); fail; } @@ -565,7 +565,7 @@ fn match_args(fcx: fn_ctxt, occs: @mutable [pred_args], fn def_id_for_constr(tcx: ty::ctxt, t: node_id) -> def_id { alt tcx.def_map.find(t) { - none. { + none { tcx.sess.bug("node_id_for_constr: bad node_id " + int::str(t)); } some(def_fn(i, _)) { ret i; } @@ -658,7 +658,7 @@ fn substitute_arg(cx: ty::ctxt, actuals: [@expr], a: @constr_arg) -> cx.sess.span_fatal(a.span, "Constraint argument out of bounds"); } } - carg_base. { ret @respan(a.span, carg_base); } + carg_base { ret @respan(a.span, carg_base); } carg_lit(l) { ret @respan(a.span, carg_lit(l)); } } } @@ -675,7 +675,7 @@ fn pred_args_matches(pattern: [constr_arg_general_<inst>], desc: pred_args) -> _ { ret false; } } } - carg_base. { if n != carg_base { ret false; } } + carg_base { if n != carg_base { ret false; } } carg_lit(l) { alt n { carg_lit(m) { if !lit_eq(l, m) { ret false; } } @@ -741,7 +741,7 @@ fn insts_to_str(stuff: [constr_arg_general_<inst>]) -> str { " " + alt i { carg_ident(p) { p.ident } - carg_base. { "*" } + carg_base { "*" } carg_lit(_) { "[lit]" } } + " "; } @@ -794,7 +794,7 @@ fn local_node_id_to_def_id_strict(fcx: fn_ctxt, sp: span, i: node_id) -> "local_node_id_to_def_id: id \ isn't a local"); } - none. { + none { // should really be bug. span_bug()? fcx.ccx.tcx.sess.span_fatal(sp, "local_node_id_to_def_id: id \ @@ -848,8 +848,8 @@ fn copy_in_poststate_two(fcx: fn_ctxt, src_post: poststate, ty: oper_type) { let subst; alt ty { - oper_swap. { subst = [{from: dest, to: src}, {from: src, to: dest}]; } - oper_assign_op. { + oper_swap { subst = [{from: dest, to: src}, {from: src, to: dest}]; } + oper_assign_op { ret; // Don't do any propagation } _ { subst = [{from: src, to: dest}]; } @@ -1003,7 +1003,7 @@ fn vec_contains(v: @mutable [node_id], i: node_id) -> bool { } fn op_to_oper_ty(io: init_op) -> oper_type { - alt io { init_move. { oper_move } _ { oper_assign } } + alt io { init_move { oper_move } _ { oper_assign } } } // default function visitor @@ -1021,7 +1021,7 @@ fn args_to_constr_args(tcx: ty::ctxt, args: [arg], actuals += [@respan(a.span, alt a.node { - carg_base. { carg_base } + carg_base { carg_base } carg_ident(i) { if i < num_args { carg_ident({ident: args[i].ident, @@ -1090,7 +1090,7 @@ fn callee_modes(fcx: fn_ctxt, callee: node_id) -> [ty::mode] { fn callee_arg_init_ops(fcx: fn_ctxt, callee: node_id) -> [init_op] { fn mode_to_op(m: ty::mode) -> init_op { - alt m { by_move. { init_move } _ { init_assign } } + alt m { by_move { init_move } _ { init_assign } } } vec::map(callee_modes(fcx, callee), mode_to_op) } diff --git a/src/comp/middle/tstate/bitvectors.rs b/src/comp/middle/tstate/bitvectors.rs index c4e09873085..f9209d60c16 100644 --- a/src/comp/middle/tstate/bitvectors.rs +++ b/src/comp/middle/tstate/bitvectors.rs @@ -48,7 +48,7 @@ fn promises_(n: uint, p: poststate) -> bool { ret tritv_get(p, n) == ttrue; } // v "happens after" u fn seq_trit(u: trit, v: trit) -> trit { - alt v { ttrue. { ttrue } tfalse. { tfalse } dont_care. { u } } + alt v { ttrue { ttrue } tfalse { tfalse } dont_care { u } } } // idea: q "happens after" p -- so if something is diff --git a/src/comp/middle/tstate/collect_locals.rs b/src/comp/middle/tstate/collect_locals.rs index 102451a6985..200aef3b6db 100644 --- a/src/comp/middle/tstate/collect_locals.rs +++ b/src/comp/middle/tstate/collect_locals.rs @@ -84,7 +84,7 @@ fn add_constraint(tcx: ty::ctxt, c: sp_constr, next: uint, tbl: constr_map) -> } } } - none. { + none { let rslt: @mutable [pred_args] = @mutable [respan(c.span, {args: args, bit_num: next})]; tbl.insert(d_id, cpred(p, rslt)); diff --git a/src/comp/middle/tstate/pre_post_conditions.rs b/src/comp/middle/tstate/pre_post_conditions.rs index 57bb0379779..5b7322fbb16 100644 --- a/src/comp/middle/tstate/pre_post_conditions.rs +++ b/src/comp/middle/tstate/pre_post_conditions.rs @@ -132,9 +132,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, find_pre_post_expr(fcx, antec); find_pre_post_block(fcx, conseq); alt maybe_alt { - none. { + none { alt chck { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); gen(fcx, antec.id, c.node); } @@ -166,7 +166,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, /* Be sure to set the bit for the check condition here, so that it's *not* set in the alternative. */ alt chck { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); gen(fcx, antec.id, c.node); } @@ -219,14 +219,14 @@ fn handle_update(fcx: fn_ctxt, parent: @expr, lhs: @expr, rhs: @expr, let tmp = tritv_clone(post); alt ty { - oper_move. { + oper_move { if is_path(rhs) { forget_in_postcond(fcx, parent.id, rhs.id); } } - oper_swap. { + oper_swap { forget_in_postcond_still_init(fcx, parent.id, lhs.id); forget_in_postcond_still_init(fcx, parent.id, rhs.id); } - oper_assign. { + oper_assign { forget_in_postcond_still_init(fcx, parent.id, lhs.id); } _ { @@ -336,7 +336,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { /* if this is a failing call, its postcondition sets everything */ alt controlflow_expr(fcx.ccx, operator) { - noreturn. { set_postcond_false(fcx.ccx, e.id); } + noreturn { set_postcond_false(fcx.ccx, e.id); } _ { } } } @@ -374,7 +374,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { } expr_rec(fields, maybe_base) { let es = field_exprs(fields); - alt maybe_base { none. {/* no-op */ } some(b) { es += [b]; } } + alt maybe_base { none {/* no-op */ } some(b) { es += [b]; } } find_pre_post_exprs(fcx, es, e.id); } expr_tup(elts) { find_pre_post_exprs(fcx, elts, e.id); } @@ -395,7 +395,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { expr_lit(_) { clear_pp(expr_pp(fcx.ccx, e)); } expr_ret(maybe_val) { alt maybe_val { - none. { + none { clear_precond(fcx.ccx, e.id); set_postcond_false(fcx.ccx, e.id); } @@ -503,7 +503,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { expr_fail(maybe_val) { let prestate; alt maybe_val { - none. { prestate = empty_prestate(num_local_vars); } + none { prestate = empty_prestate(num_local_vars); } some(fail_val) { find_pre_post_expr(fcx, fail_val); prestate = expr_precond(fcx.ccx, fail_val); @@ -542,7 +542,7 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { let i = 0; for expr_opt: option::t<@expr> in maybe_args { alt expr_opt { - none. {/* no-op */ } + none {/* no-op */ } some(expr) { modes += [cmodes[i]]; args += [expr]; } } i += 1; @@ -551,8 +551,8 @@ fn find_pre_post_expr(fcx: fn_ctxt, e: @expr) { forget_args_moved_in(fcx, e, modes, args); find_pre_post_exprs(fcx, args, e.id); } - expr_break. { clear_pp(expr_pp(fcx.ccx, e)); } - expr_cont. { clear_pp(expr_pp(fcx.ccx, e)); } + expr_break { clear_pp(expr_pp(fcx.ccx, e)); } + expr_cont { clear_pp(expr_pp(fcx.ccx, e)); } expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); } } } @@ -601,7 +601,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) { node: an_init.expr.id}, op_to_oper_ty(an_init.op)); } - none. { } + none { } } gen(fcx, id, ninit(pat.id, ident)); }; @@ -631,7 +631,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) { copy_pre_post_(fcx.ccx, id, prev_pp.precondition, prev_pp.postcondition); } - none. { + none { pat_bindings(alocal.node.pat) {|p| clear_pp(node_id_to_ts_ann(fcx.ccx, p.id).conditions); }; @@ -689,7 +689,7 @@ fn find_pre_post_block(fcx: fn_ctxt, b: blk) { let pps: [pre_and_post] = []; for s: @stmt in b.node.stmts { pps += [stmt_pp(fcx.ccx, *s)]; } alt b.node.expr { - none. {/* no-op */ } + none {/* no-op */ } some(e) { pps += [expr_pp(fcx.ccx, e)]; } } @@ -721,7 +721,7 @@ fn find_pre_post_fn(fcx: fn_ctxt, body: blk) { // Treat the tail expression as a return statement alt body.node.expr { some(tailexpr) { set_postcond_false(fcx.ccx, tailexpr.id); } - none. {/* fallthrough */ } + none {/* fallthrough */ } } } diff --git a/src/comp/middle/tstate/states.rs b/src/comp/middle/tstate/states.rs index 50208b9dacf..6256ea11b3f 100644 --- a/src/comp/middle/tstate/states.rs +++ b/src/comp/middle/tstate/states.rs @@ -15,7 +15,7 @@ import driver::session::session; fn forbid_upvar(fcx: fn_ctxt, rhs_id: node_id, sp: span, t: oper_type) { alt t { - oper_move. { + oper_move { alt local_node_id_to_def(fcx, rhs_id) { some(def_upvar(_, _, _)) { fcx.ccx.tcx.sess.span_err(sp, @@ -94,7 +94,7 @@ fn find_pre_post_state_sub(fcx: fn_ctxt, pres: prestate, e: @expr, let post = tritv_clone(expr_poststate(fcx.ccx, e)); alt c { - none. { } + none { } some(c1) { set_in_poststate_(bit_num(fcx, c1), post); } } @@ -123,11 +123,11 @@ fn find_pre_post_state_two(fcx: fn_ctxt, pres: prestate, lhs: @expr, let tmp = tritv_clone(post); alt ty { - oper_move. { + oper_move { if is_path(rhs) { forget_in_poststate(fcx, post, rhs.id); } forget_in_poststate_still_init(fcx, post, lhs.id); } - oper_swap. { + oper_swap { forget_in_poststate_still_init(fcx, post, lhs.id); forget_in_poststate_still_init(fcx, post, rhs.id); } @@ -187,7 +187,7 @@ fn find_pre_post_state_exprs(fcx: fn_ctxt, pres: prestate, id: node_id, let changed = rs.changed | set_prestate_ann(fcx.ccx, id, pres); /* if this is a failing call, it sets everything as initialized */ alt cf { - noreturn. { + noreturn { let post = false_postcond(num_constraints(fcx.enclosing)); changed |= set_poststate_ann(fcx.ccx, id, post); } @@ -265,9 +265,9 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, */ alt maybe_alt { - none. { + none { alt chk { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); let conseq_prestate = tritv_clone(expr_poststate(fcx.ccx, antec)); tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue); @@ -292,7 +292,7 @@ fn join_then_else(fcx: fn_ctxt, antec: @expr, conseq: blk, let conseq_prestate = expr_poststate(fcx.ccx, antec); alt chk { - if_check. { + if_check { let c: sp_constr = expr_to_constr(fcx.ccx.tcx, antec); conseq_prestate = tritv_clone(conseq_prestate); tritv_set(bit_num(fcx, c.node), conseq_prestate, ttrue); @@ -360,7 +360,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { let i = 0; for a_opt: option::t<@expr> in maybe_args { alt a_opt { - none. {/* no-op */ } + none {/* no-op */ } some(a) { ops += [callee_ops[i]]; args += [a]; } } i += 1; @@ -390,7 +390,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { vec::len(fields)), field_exprs(fields), return_val); alt maybe_base { - none. {/* do nothing */ } + none {/* do nothing */ } some(base) { changed |= find_pre_post_state_expr(fcx, pres, base) | @@ -431,7 +431,7 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { set_poststate_ann(fcx.ccx, e.id, post); alt maybe_ret_val { - none. {/* do nothing */ } + none {/* do nothing */ } some(ret_val) { changed |= find_pre_post_state_expr(fcx, pres, ret_val); } @@ -586,13 +586,13 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { woo! */ let post = false_postcond(num_constrs); alt fcx.enclosing.cf { - noreturn. { kill_poststate_(fcx, ninit(fcx.id, fcx.name), post); } + noreturn { kill_poststate_(fcx, ninit(fcx.id, fcx.name), post); } _ { } } ret set_prestate_ann(fcx.ccx, e.id, pres) | set_poststate_ann(fcx.ccx, e.id, post) | alt maybe_fail_val { - none. { false } + none { false } some(fail_val) { find_pre_post_state_expr(fcx, pres, fail_val) } @@ -609,8 +609,8 @@ fn find_pre_post_state_expr(fcx: fn_ctxt, pres: prestate, e: @expr) -> bool { expr_if_check(p, conseq, maybe_alt) { ret join_then_else(fcx, p, conseq, maybe_alt, e.id, if_check, pres); } - expr_break. { ret pure_exp(fcx.ccx, e.id, pres); } - expr_cont. { ret pure_exp(fcx.ccx, e.id, pres); } + expr_break { ret pure_exp(fcx.ccx, e.id, pres); } + expr_cont { ret pure_exp(fcx.ccx, e.id, pres); } } } @@ -704,7 +704,7 @@ fn find_pre_post_state_block(fcx: fn_ctxt, pres0: prestate, b: blk) -> bool { } let post = pres; alt b.node.expr { - none. { } + none { } some(e) { changed |= find_pre_post_state_expr(fcx, pres, e); post = expr_poststate(fcx.ccx, e); @@ -767,7 +767,7 @@ fn find_pre_post_state_fn(fcx: fn_ctxt, set_poststate_ann(fcx.ccx, f_body.node.id, post); } } - none. {/* fallthrough */ } + none {/* fallthrough */ } } /* diff --git a/src/comp/middle/tstate/tritv.rs b/src/comp/middle/tstate/tritv.rs index c979b1aa74e..6a7504de5c3 100644 --- a/src/comp/middle/tstate/tritv.rs +++ b/src/comp/middle/tstate/tritv.rs @@ -49,25 +49,25 @@ fn trit_minus(a: trit, b: trit) -> trit { 0 - anything else - 0 */ alt a { - dont_care. { dont_care } - ttrue. { + dont_care { dont_care } + ttrue { alt b { - ttrue. { dont_care } - tfalse. { ttrue } + ttrue { dont_care } + tfalse { ttrue } /* internally contradictory, but I guess it'll get flagged? */ - dont_care. { + dont_care { ttrue } } } - tfalse. { + tfalse { alt b { - ttrue. { tfalse } + ttrue { tfalse } @@ -83,11 +83,11 @@ fn trit_minus(a: trit, b: trit) -> trit { fn trit_or(a: trit, b: trit) -> trit { alt a { - dont_care. { b } - ttrue. { ttrue } - tfalse. { + dont_care { b } + ttrue { ttrue } + tfalse { alt b { - ttrue. { dont_care } + ttrue { dont_care } @@ -108,21 +108,21 @@ fn trit_or(a: trit, b: trit) -> trit { // (we consider a constraint false until proven true), too. fn trit_and(a: trit, b: trit) -> trit { alt a { - dont_care. { b } + dont_care { b } // also seems wrong for case b = ttrue - ttrue. { + ttrue { alt b { - dont_care. { ttrue } + dont_care { ttrue } // ??? Seems wrong - ttrue. { + ttrue { ttrue } @@ -135,7 +135,7 @@ fn trit_and(a: trit, b: trit) -> trit { // (Rationale: it's always safe to assume that // a var is uninitialized or that a constraint // needs to be re-established) - tfalse. { + tfalse { tfalse } } @@ -147,7 +147,7 @@ fn trit_and(a: trit, b: trit) -> trit { // Rationale: if it's uninit on one path, // we can consider it as uninit on all paths - tfalse. { + tfalse { tfalse } } @@ -214,12 +214,12 @@ fn tritv_get(v: t, i: uint) -> trit { fn tritv_set(i: uint, v: t, t: trit) -> bool { let old = tritv_get(v, i); alt t { - dont_care. { + dont_care { bitv::set(v.uncertain, i, true); bitv::set(v.val, i, false); } - ttrue. { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, true); } - tfalse. { + ttrue { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, true); } + tfalse { bitv::set(v.uncertain, i, false); bitv::set(v.val, i, false); } @@ -273,9 +273,9 @@ fn to_vec(v: t) -> [uint] { while i < v.nbits { rslt += [alt tritv_get(v, i) { - dont_care. { 2u } - ttrue. { 1u } - tfalse. { 0u } + dont_care { 2u } + ttrue { 1u } + tfalse { 0u } }]; i += 1u; } @@ -288,9 +288,9 @@ fn to_str(v: t) -> str { while i < v.nbits { rs += alt tritv_get(v, i) { - dont_care. { "?" } - ttrue. { "1" } - tfalse. { "0" } + dont_care { "?" } + ttrue { "1" } + tfalse { "0" } }; i += 1u; } |
