diff options
| author | Brian Anderson <[email protected]> | 2011-03-06 17:49:19 -0500 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-14 16:41:46 -0700 |
| commit | a3cca65f6d77d9d7d27b3ace84da4730030ffd59 (patch) | |
| tree | bc26777ea4a59038a36878ca62a00041336b2074 /src | |
| parent | Parse receive expressions (diff) | |
| download | rust-a3cca65f6d77d9d7d27b3ace84da4730030ffd59.tar.xz rust-a3cca65f6d77d9d7d27b3ace84da4730030ffd59.zip | |
Fold ty_chan and ty_port
Diffstat (limited to 'src')
| -rw-r--r-- | src/comp/middle/fold.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index 17a2a2ca..bb2af121 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -67,6 +67,8 @@ type ast_fold[ENV] = &option.t[def] d) -> @ty) fold_ty_path, (fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_mutable, + (fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_chan, + (fn(&ENV e, &span sp, @ty t) -> @ty) fold_ty_port, // Expr folds. (fn(&ENV e, &span sp, @@ -386,6 +388,16 @@ fn fold_ty[ENV](&ENV env, ast_fold[ENV] fld, @ty t) -> @ty { case (ast.ty_fn(?proto, ?inputs, ?output)) { ret fold_ty_fn(env_, fld, t.span, proto, inputs, output); } + + case (ast.ty_chan(?ty)) { + auto ty_ = fold_ty(env, fld, ty); + ret fld.fold_ty_chan(env_, t.span, ty_); + } + + case (ast.ty_port(?ty)) { + auto ty_ = fold_ty(env, fld, ty); + ret fld.fold_ty_port(env_, t.span, ty_); + } } } @@ -1083,6 +1095,13 @@ fn identity_fold_ty_mutable[ENV](&ENV env, &span sp, @ty t) -> @ty { ret @respan(sp, ast.ty_mutable(t)); } +fn identity_fold_ty_chan[ENV](&ENV env, &span sp, @ty t) -> @ty { + ret @respan(sp, ast.ty_chan(t)); +} + +fn identity_fold_ty_port[ENV](&ENV env, &span sp, @ty t) -> @ty { + ret @respan(sp, ast.ty_port(t)); +} // Expr identities. @@ -1473,6 +1492,8 @@ fn new_identity_fold[ENV]() -> ast_fold[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_ty_chan = bind identity_fold_ty_chan[ENV](_,_,_), + fold_ty_port = bind identity_fold_ty_port[ENV](_,_,_), fold_expr_vec = bind identity_fold_expr_vec[ENV](_,_,_,_), fold_expr_tup = bind identity_fold_expr_tup[ENV](_,_,_,_), |