diff options
| author | bors <bors@rust-lang.org> | 2013-06-01 19:22:42 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-01 19:22:42 -0700 |
| commit | fc5debd8fdda339e1453dc43368f4bfb15459841 (patch) | |
| tree | a445c8ab39274ce9520ff898a6b71f3702a09b59 /src/libsyntax | |
| parent | 63417daea4058646ef07a880edc79653ddc16bbf (diff) | |
| parent | 60126e9365e86f9697508455290850564ac9186e (diff) | |
| download | rust-fc5debd8fdda339e1453dc43368f4bfb15459841.tar.gz rust-fc5debd8fdda339e1453dc43368f4bfb15459841.zip | |
auto merge of #6807 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Addresses #5681
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index eab8c0a12d3..95dce88d450 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -562,6 +562,21 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat) -> bool) -> bool { } } +pub trait EachViewItem { + pub fn each_view_item(&self, f: @fn(@ast::view_item) -> bool) -> bool; +} + +impl EachViewItem for ast::crate { + fn each_view_item(&self, f: @fn(@ast::view_item) -> bool) -> bool { + let broke = @mut false; + let vtor: visit::vt<()> = visit::mk_simple_visitor(@visit::SimpleVisitor { + visit_view_item: |vi| { *broke = f(vi); }, ..*visit::default_simple_visitor() + }); + visit::visit_crate(self, (), vtor); + true + } +} + pub fn view_path_id(p: @view_path) -> node_id { match p.node { view_path_simple(_, _, id) | |
