diff options
| author | Patrick Walton <[email protected]> | 2011-05-13 16:53:35 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-05-13 16:53:35 -0700 |
| commit | 23d3b0ec57e5dde910d0fbb5dc84dcd9c0d62024 (patch) | |
| tree | d3996916176cc3e031125c1790cb5e15d81e297f /src/comp/middle | |
| parent | rustc: Make all type lookups go through the one ty::ann_to_ty_param_substs_op... (diff) | |
| download | rust-23d3b0ec57e5dde910d0fbb5dc84dcd9c0d62024.tar.xz rust-23d3b0ec57e5dde910d0fbb5dc84dcd9c0d62024.zip | |
rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train
Diffstat (limited to 'src/comp/middle')
| -rw-r--r-- | src/comp/middle/ty.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index fcee03bf..34d62b7d 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -1468,6 +1468,12 @@ fn ann_to_type_params(&node_type_table ntt, &ast::ann ann) -> vec[t] { } } +fn ann_has_type_params(&node_type_table ntt, &ast::ann ann) -> bool { + auto tpt = ann_to_ty_param_substs_opt_and_ty(ntt, ann); + ret !option::is_none[vec[t]](tpt._0); +} + + // Returns the type of an annotation, with type parameter substitutions // performed if applicable. 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) } fn expr_has_ty_params(&node_type_table ntt, &@ast::expr expr) -> bool { - // FIXME: Rewrite using complex patterns when they're trustworthy. - alt (expr_ann(expr)) { - case (ast::ann_none(_)) { fail; } - case (ast::ann_type(_, _, ?tps_opt, _)) { - ret !option::is_none[vec[t]](tps_opt); - } - } + ret ann_has_type_params(ntt, expr_ann(expr)); } // FIXME: At the moment this works only for call, bind, and path expressions. |