diff options
| author | Graydon Hoare <[email protected]> | 2011-03-09 17:34:22 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-03-09 17:34:22 -0800 |
| commit | bafcbb101c104b136ce781380ce6944c49b77691 (patch) | |
| tree | 17fa6a8d4487faa57effbd1e185388cc114bd0cb /src/comp | |
| parent | Remove redundant imports in lib (rustc doesn't like 'std' as a synonym for ro... (diff) | |
| download | rust-bafcbb101c104b136ce781380ce6944c49b77691.tar.xz rust-bafcbb101c104b136ce781380ce6944c49b77691.zip | |
Fold exports.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/fold.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs index ccf3457b..d08b979a 100644 --- a/src/comp/middle/fold.rs +++ b/src/comp/middle/fold.rs @@ -254,6 +254,8 @@ type ast_fold[ENV] = (fn(&ENV e, &span sp, ident i, vec[ident] idents, def_id id, option.t[def]) -> @view_item) fold_view_item_import, + (fn(&ENV e, &span sp, ident i) -> @view_item) fold_view_item_export, + // Additional nodes. (fn(&ENV e, &span sp, &ast.block_) -> block) fold_block, @@ -852,6 +854,10 @@ fn fold_view_item[ENV](&ENV env, ast_fold[ENV] fld, @view_item vi) ret fld.fold_view_item_import(env_, vi.span, def_ident, idents, def_id, target_def); } + + case (ast.view_item_export(?def_ident)) { + ret fld.fold_view_item_export(env_, vi.span, def_ident); + } } fail; @@ -1339,6 +1345,11 @@ fn identity_fold_view_item_import[ENV](&ENV e, &span sp, ident i, ret @respan(sp, ast.view_item_import(i, is, id, target_def)); } +fn identity_fold_view_item_export[ENV](&ENV e, &span sp, ident i) + -> @view_item { + ret @respan(sp, ast.view_item_export(i)); +} + // Additional identities. fn identity_fold_block[ENV](&ENV e, &span sp, &ast.block_ blk) -> block { @@ -1516,6 +1527,8 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] { bind identity_fold_view_item_use[ENV](_,_,_,_,_), fold_view_item_import = bind identity_fold_view_item_import[ENV](_,_,_,_,_,_), + fold_view_item_export = + bind identity_fold_view_item_export[ENV](_,_,_), fold_block = bind identity_fold_block[ENV](_,_,_), fold_fn = bind identity_fold_fn[ENV](_,_,_,_), |