aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle/ty.rs
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-05-13 17:06:00 -0700
committerPatrick Walton <[email protected]>2011-05-13 17:06:30 -0700
commitfac13425138bdadae8ab738efa538641af33c12e (patch)
tree170541c377365702f376506ffe3718a70705d8dc /src/comp/middle/ty.rs
parentrustc: Fix long lines in typeck.rs (diff)
downloadrust-fac13425138bdadae8ab738efa538641af33c12e.tar.xz
rust-fac13425138bdadae8ab738efa538641af33c12e.zip
rustc: Move replace_expr_type() from ty to typeck, as it's only used in the latter
Diffstat (limited to 'src/comp/middle/ty.rs')
-rw-r--r--src/comp/middle/ty.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 34d62b7d..a0c3a724 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -1721,50 +1721,6 @@ fn expr_has_ty_params(&node_type_table ntt, &@ast::expr expr) -> bool {
ret ann_has_type_params(ntt, expr_ann(expr));
}
-// FIXME: At the moment this works only for call, bind, and path expressions.
-fn replace_expr_type(&node_type_table ntt,
- &@ast::expr expr,
- &tup(vec[t], t) new_tyt) -> @ast::expr {
- auto new_tps;
- if (expr_has_ty_params(ntt, expr)) {
- new_tps = some[vec[t]](new_tyt._0);
- } else {
- new_tps = none[vec[t]];
- }
-
- fn mkann_fn(t tyt, option::t[vec[t]] tps, &ast::ann old_ann) -> ast::ann {
- ret ast::ann_type(ast::ann_tag(old_ann), tyt, tps, none[@ts_ann]);
- }
- auto mkann = bind mkann_fn(new_tyt._1, new_tps, _);
-
- alt (expr.node) {
- case (ast::expr_call(?callee, ?args, ?a)) {
- ret @fold::respan(expr.span,
- ast::expr_call(callee, args, mkann(a)));
- }
- case (ast::expr_self_method(?ident, ?a)) {
- ret @fold::respan(expr.span,
- ast::expr_self_method(ident, mkann(a)));
- }
- case (ast::expr_bind(?callee, ?args, ?a)) {
- ret @fold::respan(expr.span,
- ast::expr_bind(callee, args, mkann(a)));
- }
- case (ast::expr_field(?e, ?i, ?a)) {
- ret @fold::respan(expr.span,
- ast::expr_field(e, i, mkann(a)));
- }
- case (ast::expr_path(?p, ?a)) {
- ret @fold::respan(expr.span,
- ast::expr_path(p, mkann(a)));
- }
- case (_) {
- log_err "unhandled expr type in replace_expr_type(): " +
- util::common::expr_to_str(expr);
- fail;
- }
- }
-}
// Expression utilities