Skip to content

Commit 23d3b0e

Browse files
committed
rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train
1 parent 0739849 commit 23d3b0e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/comp/middle/ty.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,12 @@ fn ann_to_type_params(&node_type_table ntt, &ast::ann ann) -> vec[t] {
14681468
}
14691469
}
14701470

1471+
fn ann_has_type_params(&node_type_table ntt, &ast::ann ann) -> bool {
1472+
auto tpt = ann_to_ty_param_substs_opt_and_ty(ntt, ann);
1473+
ret !option::is_none[vec[t]](tpt._0);
1474+
}
1475+
1476+
14711477
// Returns the type of an annotation, with type parameter substitutions
14721478
// performed if applicable.
14731479
fn ann_to_monotype(ctxt cx, &node_type_table ntt, ast::ann a) -> t {
@@ -1712,13 +1718,7 @@ fn expr_ty_params_and_ty(&ctxt cx, &node_type_table ntt, &@ast::expr expr)
17121718
}
17131719

17141720
fn expr_has_ty_params(&node_type_table ntt, &@ast::expr expr) -> bool {
1715-
// FIXME: Rewrite using complex patterns when they're trustworthy.
1716-
alt (expr_ann(expr)) {
1717-
case (ast::ann_none(_)) { fail; }
1718-
case (ast::ann_type(_, _, ?tps_opt, _)) {
1719-
ret !option::is_none[vec[t]](tps_opt);
1720-
}
1721-
}
1721+
ret ann_has_type_params(ntt, expr_ann(expr));
17221722
}
17231723

17241724
// FIXME: At the moment this works only for call, bind, and path expressions.

0 commit comments

Comments
 (0)