aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle/fold.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-11-29 12:29:57 -0800
committerGraydon Hoare <[email protected]>2010-11-29 12:29:57 -0800
commit38846e39c4be0f12241ab0df2e94cbb366ae34ba (patch)
tree78b01de1abc68687f5057619de868763b8daf07b /src/comp/middle/fold.rs
parentAdd mut field to typeck.ty. (diff)
downloadrust-38846e39c4be0f12241ab0df2e94cbb366ae34ba.tar.xz
rust-38846e39c4be0f12241ab0df2e94cbb366ae34ba.zip
Add ast.ty_mutable.
Diffstat (limited to 'src/comp/middle/fold.rs')
-rw-r--r--src/comp/middle/fold.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index de2fd87a..1caaa00e 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -55,6 +55,8 @@ type ast_fold[ENV] =
(fn(&ENV e, &span sp, ast.path p,
&option.t[def] d) -> @ty) fold_ty_path,
+ (fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_mutable,
+
// Expr folds.
(fn(&ENV e, &span sp,
vec[@expr] es, ann a) -> @expr) fold_expr_vec,
@@ -258,6 +260,11 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty {
ret fld.fold_ty_path(env_, t.span, path, ref_opt);
}
+ case (ast.ty_mutable(?ty)) {
+ auto ty_ = fold_ty(env, fld, ty);
+ ret fld.fold_ty_mutable(env_, t.span, ty_);
+ }
+
case (ast.ty_fn(?inputs, ?output)) {
ret fld.fold_ty_fn(env_, t.span, inputs, output);
}
@@ -659,6 +666,10 @@ fn identity_fold_ty_path[ENV](&ENV env, &span sp, ast.path p,
ret @respan(sp, ast.ty_path(p, d));
}
+fn identity_fold_ty_mutable[ENV](&ENV env, &span sp, @ty t) -> @ty {
+ ret @respan(sp, ast.ty_mutable(t));
+}
+
// Expr identities.
@@ -908,6 +919,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
fold_ty_tup = bind identity_fold_ty_tup[ENV](_,_,_),
fold_ty_fn = bind identity_fold_ty_fn[ENV](_,_,_,_),
fold_ty_path = bind identity_fold_ty_path[ENV](_,_,_,_),
+ fold_ty_mutable = bind identity_fold_ty_mutable[ENV](_,_,_),
fold_expr_vec = bind identity_fold_expr_vec[ENV](_,_,_,_),
fold_expr_tup = bind identity_fold_expr_tup[ENV](_,_,_,_),