diff options
Diffstat (limited to 'crates/libsyntax2/src/ast/generated.rs')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index e8743caa8..d72e2091a 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -4,6 +4,28 @@ use { | |||
4 | SyntaxKind::*, | 4 | SyntaxKind::*, |
5 | }; | 5 | }; |
6 | 6 | ||
7 | // ArgList | ||
8 | #[derive(Debug, Clone, Copy)] | ||
9 | pub struct ArgList<'a> { | ||
10 | syntax: SyntaxNodeRef<'a>, | ||
11 | } | ||
12 | |||
13 | impl<'a> AstNode<'a> for ArgList<'a> { | ||
14 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
15 | match syntax.kind() { | ||
16 | ARG_LIST => Some(ArgList { syntax }), | ||
17 | _ => None, | ||
18 | } | ||
19 | } | ||
20 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
21 | } | ||
22 | |||
23 | impl<'a> ArgList<'a> { | ||
24 | pub fn args(self) -> impl Iterator<Item = Expr<'a>> + 'a { | ||
25 | super::children(self) | ||
26 | } | ||
27 | } | ||
28 | |||
7 | // ArrayExpr | 29 | // ArrayExpr |
8 | #[derive(Debug, Clone, Copy)] | 30 | #[derive(Debug, Clone, Copy)] |
9 | pub struct ArrayExpr<'a> { | 31 | pub struct ArrayExpr<'a> { |
@@ -181,7 +203,15 @@ impl<'a> AstNode<'a> for CallExpr<'a> { | |||
181 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | 203 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } |
182 | } | 204 | } |
183 | 205 | ||
184 | impl<'a> CallExpr<'a> {} | 206 | impl<'a> CallExpr<'a> { |
207 | pub fn expr(self) -> Option<Expr<'a>> { | ||
208 | super::child_opt(self) | ||
209 | } | ||
210 | |||
211 | pub fn arg_list(self) -> Option<ArgList<'a>> { | ||
212 | super::child_opt(self) | ||
213 | } | ||
214 | } | ||
185 | 215 | ||
186 | // CastExpr | 216 | // CastExpr |
187 | #[derive(Debug, Clone, Copy)] | 217 | #[derive(Debug, Clone, Copy)] |
@@ -705,7 +735,15 @@ impl<'a> AstNode<'a> for LambdaExpr<'a> { | |||
705 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | 735 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } |
706 | } | 736 | } |
707 | 737 | ||
708 | impl<'a> LambdaExpr<'a> {} | 738 | impl<'a> LambdaExpr<'a> { |
739 | pub fn param_list(self) -> Option<ParamList<'a>> { | ||
740 | super::child_opt(self) | ||
741 | } | ||
742 | |||
743 | pub fn body(self) -> Option<Expr<'a>> { | ||
744 | super::child_opt(self) | ||
745 | } | ||
746 | } | ||
709 | 747 | ||
710 | // LetStmt | 748 | // LetStmt |
711 | #[derive(Debug, Clone, Copy)] | 749 | #[derive(Debug, Clone, Copy)] |
@@ -733,6 +771,46 @@ impl<'a> LetStmt<'a> { | |||
733 | } | 771 | } |
734 | } | 772 | } |
735 | 773 | ||
774 | // Lifetime | ||
775 | #[derive(Debug, Clone, Copy)] | ||
776 | pub struct Lifetime<'a> { | ||
777 | syntax: SyntaxNodeRef<'a>, | ||
778 | } | ||
779 | |||
780 | impl<'a> AstNode<'a> for Lifetime<'a> { | ||
781 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
782 | match syntax.kind() { | ||
783 | LIFETIME => Some(Lifetime { syntax }), | ||
784 | _ => None, | ||
785 | } | ||
786 | } | ||
787 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
788 | } | ||
789 | |||
790 | impl<'a> Lifetime<'a> {} | ||
791 | |||
792 | // LifetimeParam | ||
793 | #[derive(Debug, Clone, Copy)] | ||
794 | pub struct LifetimeParam<'a> { | ||
795 | syntax: SyntaxNodeRef<'a>, | ||
796 | } | ||
797 | |||
798 | impl<'a> AstNode<'a> for LifetimeParam<'a> { | ||
799 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
800 | match syntax.kind() { | ||
801 | LIFETIME_PARAM => Some(LifetimeParam { syntax }), | ||
802 | _ => None, | ||
803 | } | ||
804 | } | ||
805 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
806 | } | ||
807 | |||
808 | impl<'a> LifetimeParam<'a> { | ||
809 | pub fn lifetime(self) -> Option<Lifetime<'a>> { | ||
810 | super::child_opt(self) | ||
811 | } | ||
812 | } | ||
813 | |||
736 | // Literal | 814 | // Literal |
737 | #[derive(Debug, Clone, Copy)] | 815 | #[derive(Debug, Clone, Copy)] |
738 | pub struct Literal<'a> { | 816 | pub struct Literal<'a> { |
@@ -1813,6 +1891,10 @@ impl<'a> TypeParamList<'a> { | |||
1813 | pub fn type_params(self) -> impl Iterator<Item = TypeParam<'a>> + 'a { | 1891 | pub fn type_params(self) -> impl Iterator<Item = TypeParam<'a>> + 'a { |
1814 | super::children(self) | 1892 | super::children(self) |
1815 | } | 1893 | } |
1894 | |||
1895 | pub fn lifetime_params(self) -> impl Iterator<Item = LifetimeParam<'a>> + 'a { | ||
1896 | super::children(self) | ||
1897 | } | ||
1816 | } | 1898 | } |
1817 | 1899 | ||
1818 | // TypeRef | 1900 | // TypeRef |