aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-21 16:30:10 +0100
committerAleksey Kladov <[email protected]>2018-08-21 16:30:10 +0100
commitb937262c9b75a361b95a6a27260a71c737e035bf (patch)
tree1838794f32d43a8c45c478b9f24bd74d257edd43 /crates/libsyntax2/src/ast
parent4d8be265849c55912467961e09af657176472dcb (diff)
Module map implementation
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index e8a87eba5..610b5198c 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -127,6 +127,12 @@ impl<'a> File<'a> {
127 .children() 127 .children()
128 .filter_map(FnDef::cast) 128 .filter_map(FnDef::cast)
129 } 129 }
130
131 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a {
132 self.syntax()
133 .children()
134 .filter_map(Module::cast)
135 }
130} 136}
131 137
132// FnDef 138// FnDef
@@ -239,7 +245,13 @@ impl<'a> AstNode<'a> for Module<'a> {
239 245
240impl<'a> ast::NameOwner<'a> for Module<'a> {} 246impl<'a> ast::NameOwner<'a> for Module<'a> {}
241impl<'a> ast::AttrsOwner<'a> for Module<'a> {} 247impl<'a> ast::AttrsOwner<'a> for Module<'a> {}
242impl<'a> Module<'a> {} 248impl<'a> Module<'a> {
249 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a {
250 self.syntax()
251 .children()
252 .filter_map(Module::cast)
253 }
254}
243 255
244// Name 256// Name
245#[derive(Debug, Clone, Copy)] 257#[derive(Debug, Clone, Copy)]