about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-05-16 11:43:50 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-05-16 11:43:50 -0700
commitca51b49c0a0122b2efd827fa96a656a8b1641efa (patch)
treea820746f3fa89b63b07f336978a0a002dcc83904 /src
parent3aaf02b9075101086fba0d4491a3ad03d749fc84 (diff)
downloadrust-ca51b49c0a0122b2efd827fa96a656a8b1641efa.tar.gz
rust-ca51b49c0a0122b2efd827fa96a656a8b1641efa.zip
rustc: Replace the redundant typeck::node_ann_ty_params() with ty::ann_to_type_params()
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs24
1 files changed, 4 insertions, 20 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index b267af16043..3fa7c8012c2 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3287,24 +3287,6 @@ fn node_ann_type(&@crate_ctxt cx, &ast::ann a) -> ty::t {
     ret target_type(cx, ty::ann_to_monotype(cx.tcx, cx.node_types, a));
 }
 
-fn node_ann_ty_params(&ast::ann a) -> vec[ty::t] {
-    alt (a) {
-        case (ast::ann_none(_)) {
-            log_err "missing type annotation";
-            fail;
-        }
-        case (ast::ann_type(_, _, ?tps_opt, _)) {
-            alt (tps_opt) {
-                case (none[vec[ty::t]]) {
-                    log_err "type annotation has no ty params";
-                    fail;
-                }
-                case (some[vec[ty::t]](?tps)) { ret tps; }
-            }
-        }
-    }
-}
-
 fn node_type(&@crate_ctxt cx, &ast::ann a) -> TypeRef {
     ret type_of(cx, node_ann_type(cx, a));
 }
@@ -4151,7 +4133,8 @@ fn trans_pat_match(&@block_ctxt cx, &@ast::pat pat, ValueRef llval,
                                       C_int(variant_tag));
             cx.build.CondBr(lleq, matched_cx.llbb, next_cx.llbb);
 
-            auto ty_params = node_ann_ty_params(ann);
+            auto ty_params = ty::ann_to_type_params(cx.fcx.lcx.ccx.node_types,
+                                                    ann);
 
             if (_vec::len[@ast::pat](subpats) > 0u) {
                 auto llblobptr = matched_cx.build.GEP(lltagptr,
@@ -4215,7 +4198,8 @@ fn trans_pat_binding(&@block_ctxt cx, &@ast::pat pat,
                 T_opaque_tag_ptr(cx.fcx.lcx.ccx.tn));
             auto llblobptr = cx.build.GEP(lltagptr, vec(C_int(0), C_int(1)));
 
-            auto ty_param_substs = node_ann_ty_params(ann);
+            auto ty_param_substs =
+                ty::ann_to_type_params(cx.fcx.lcx.ccx.node_types, ann);
 
             auto this_cx = cx;
             auto i = 0;