From 23d3b0ec57e5dde910d0fbb5dc84dcd9c0d62024 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 13 May 2011 16:53:35 -0700 Subject: [PATCH] rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train --- src/comp/middle/ty.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index fcee03bf0e4..34d62b7dae0 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.