aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/ast/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/ast/generated.rs')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs33
1 files changed, 26 insertions, 7 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index 11306a835..4a57837df 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -682,6 +682,28 @@ impl<'a> AstNode<'a> for IndexExpr<'a> {
682 682
683impl<'a> IndexExpr<'a> {} 683impl<'a> IndexExpr<'a> {}
684 684
685// ItemList
686#[derive(Debug, Clone, Copy)]
687pub struct ItemList<'a> {
688 syntax: SyntaxNodeRef<'a>,
689}
690
691impl<'a> AstNode<'a> for ItemList<'a> {
692 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
693 match syntax.kind() {
694 ITEM_LIST => Some(ItemList { syntax }),
695 _ => None,
696 }
697 }
698 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
699}
700
701impl<'a> ItemList<'a> {
702 pub fn items(self) -> impl Iterator<Item = ModuleItem<'a>> + 'a {
703 super::children(self)
704 }
705}
706
685// Label 707// Label
686#[derive(Debug, Clone, Copy)] 708#[derive(Debug, Clone, Copy)]
687pub struct Label<'a> { 709pub struct Label<'a> {
@@ -956,9 +978,9 @@ impl<'a> AstNode<'a> for Module<'a> {
956 978
957impl<'a> ast::NameOwner<'a> for Module<'a> {} 979impl<'a> ast::NameOwner<'a> for Module<'a> {}
958impl<'a> ast::AttrsOwner<'a> for Module<'a> {} 980impl<'a> ast::AttrsOwner<'a> for Module<'a> {}
959impl<'a> Module<'a> { 981impl<'a> ast::FnDefOwner<'a> for Module<'a> {}
960 pub fn items(self) -> impl Iterator<Item = ModuleItem<'a>> + 'a { 982impl<'a> Module<'a> {pub fn item_list(self) -> Option<ItemList<'a>> {
961 super::children(self) 983 super::child_opt(self)
962 } 984 }
963} 985}
964 986
@@ -1593,15 +1615,12 @@ impl<'a> AstNode<'a> for Root<'a> {
1593 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1615 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1594} 1616}
1595 1617
1618impl<'a> ast::FnDefOwner<'a> for Root<'a> {}
1596impl<'a> Root<'a> { 1619impl<'a> Root<'a> {
1597 pub fn items(self) -> impl Iterator<Item = ModuleItem<'a>> + 'a { 1620 pub fn items(self) -> impl Iterator<Item = ModuleItem<'a>> + 'a {
1598 super::children(self) 1621 super::children(self)
1599 } 1622 }
1600 1623
1601 pub fn functions(self) -> impl Iterator<Item = FnDef<'a>> + 'a {
1602 super::children(self)
1603 }
1604
1605 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a { 1624 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a {
1606 super::children(self) 1625 super::children(self)
1607 } 1626 }