aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs96
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera3
2 files changed, 65 insertions, 34 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 2db6dff1b..f27093291 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -81,7 +81,8 @@ impl<'a> AstNode<'a> for Attr<'a> {
81 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 81 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
82} 82}
83 83
84impl<'a> Attr<'a> {pub fn value(self) -> Option<TokenTree<'a>> { 84impl<'a> Attr<'a> {
85 pub fn value(self) -> Option<TokenTree<'a>> {
85 super::child_opt(self) 86 super::child_opt(self)
86 } 87 }
87} 88}
@@ -143,7 +144,8 @@ impl<'a> Block<'a> {
143 pub fn statements(self) -> impl Iterator<Item = Stmt<'a>> + 'a { 144 pub fn statements(self) -> impl Iterator<Item = Stmt<'a>> + 'a {
144 super::children(self) 145 super::children(self)
145 } 146 }
146pub fn expr(self) -> Option<Expr<'a>> { 147
148 pub fn expr(self) -> Option<Expr<'a>> {
147 super::child_opt(self) 149 super::child_opt(self)
148 } 150 }
149} 151}
@@ -164,7 +166,8 @@ impl<'a> AstNode<'a> for BlockExpr<'a> {
164 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 166 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
165} 167}
166 168
167impl<'a> BlockExpr<'a> {pub fn block(self) -> Option<Block<'a>> { 169impl<'a> BlockExpr<'a> {
170 pub fn block(self) -> Option<Block<'a>> {
168 super::child_opt(self) 171 super::child_opt(self)
169 } 172 }
170} 173}
@@ -204,7 +207,8 @@ impl<'a> AstNode<'a> for CallExpr<'a> {
204} 207}
205 208
206impl<'a> ast::ArgListOwner<'a> for CallExpr<'a> {} 209impl<'a> ast::ArgListOwner<'a> for CallExpr<'a> {}
207impl<'a> CallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> { 210impl<'a> CallExpr<'a> {
211 pub fn expr(self) -> Option<Expr<'a>> {
208 super::child_opt(self) 212 super::child_opt(self)
209 } 213 }
210} 214}
@@ -243,10 +247,12 @@ impl<'a> AstNode<'a> for Condition<'a> {
243 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 247 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
244} 248}
245 249
246impl<'a> Condition<'a> {pub fn pat(self) -> Option<Pat<'a>> { 250impl<'a> Condition<'a> {
251 pub fn pat(self) -> Option<Pat<'a>> {
247 super::child_opt(self) 252 super::child_opt(self)
248 } 253 }
249pub fn expr(self) -> Option<Expr<'a>> { 254
255 pub fn expr(self) -> Option<Expr<'a>> {
250 super::child_opt(self) 256 super::child_opt(self)
251 } 257 }
252} 258}
@@ -460,7 +466,8 @@ impl<'a> AstNode<'a> for ExprStmt<'a> {
460 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 466 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
461} 467}
462 468
463impl<'a> ExprStmt<'a> {pub fn expr(self) -> Option<Expr<'a>> { 469impl<'a> ExprStmt<'a> {
470 pub fn expr(self) -> Option<Expr<'a>> {
464 super::child_opt(self) 471 super::child_opt(self)
465 } 472 }
466} 473}
@@ -538,13 +545,16 @@ impl<'a> AstNode<'a> for FnDef<'a> {
538impl<'a> ast::NameOwner<'a> for FnDef<'a> {} 545impl<'a> ast::NameOwner<'a> for FnDef<'a> {}
539impl<'a> ast::TypeParamsOwner<'a> for FnDef<'a> {} 546impl<'a> ast::TypeParamsOwner<'a> for FnDef<'a> {}
540impl<'a> ast::AttrsOwner<'a> for FnDef<'a> {} 547impl<'a> ast::AttrsOwner<'a> for FnDef<'a> {}
541impl<'a> FnDef<'a> {pub fn param_list(self) -> Option<ParamList<'a>> { 548impl<'a> FnDef<'a> {
549 pub fn param_list(self) -> Option<ParamList<'a>> {
542 super::child_opt(self) 550 super::child_opt(self)
543 } 551 }
544pub fn body(self) -> Option<Block<'a>> { 552
553 pub fn body(self) -> Option<Block<'a>> {
545 super::child_opt(self) 554 super::child_opt(self)
546 } 555 }
547pub fn ret_type(self) -> Option<RetType<'a>> { 556
557 pub fn ret_type(self) -> Option<RetType<'a>> {
548 super::child_opt(self) 558 super::child_opt(self)
549 } 559 }
550} 560}
@@ -584,10 +594,12 @@ impl<'a> AstNode<'a> for ForExpr<'a> {
584} 594}
585 595
586impl<'a> ast::LoopBodyOwner<'a> for ForExpr<'a> {} 596impl<'a> ast::LoopBodyOwner<'a> for ForExpr<'a> {}
587impl<'a> ForExpr<'a> {pub fn pat(self) -> Option<Pat<'a>> { 597impl<'a> ForExpr<'a> {
598 pub fn pat(self) -> Option<Pat<'a>> {
588 super::child_opt(self) 599 super::child_opt(self)
589 } 600 }
590pub fn iterable(self) -> Option<Expr<'a>> { 601
602 pub fn iterable(self) -> Option<Expr<'a>> {
591 super::child_opt(self) 603 super::child_opt(self)
592 } 604 }
593} 605}
@@ -626,7 +638,8 @@ impl<'a> AstNode<'a> for IfExpr<'a> {
626 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 638 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
627} 639}
628 640
629impl<'a> IfExpr<'a> {pub fn condition(self) -> Option<Condition<'a>> { 641impl<'a> IfExpr<'a> {
642 pub fn condition(self) -> Option<Condition<'a>> {
630 super::child_opt(self) 643 super::child_opt(self)
631 } 644 }
632} 645}
@@ -739,10 +752,12 @@ impl<'a> AstNode<'a> for LambdaExpr<'a> {
739 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 752 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
740} 753}
741 754
742impl<'a> LambdaExpr<'a> {pub fn param_list(self) -> Option<ParamList<'a>> { 755impl<'a> LambdaExpr<'a> {
756 pub fn param_list(self) -> Option<ParamList<'a>> {
743 super::child_opt(self) 757 super::child_opt(self)
744 } 758 }
745pub fn body(self) -> Option<Expr<'a>> { 759
760 pub fn body(self) -> Option<Expr<'a>> {
746 super::child_opt(self) 761 super::child_opt(self)
747 } 762 }
748} 763}
@@ -763,10 +778,12 @@ impl<'a> AstNode<'a> for LetStmt<'a> {
763 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 778 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
764} 779}
765 780
766impl<'a> LetStmt<'a> {pub fn pat(self) -> Option<Pat<'a>> { 781impl<'a> LetStmt<'a> {
782 pub fn pat(self) -> Option<Pat<'a>> {
767 super::child_opt(self) 783 super::child_opt(self)
768 } 784 }
769pub fn initializer(self) -> Option<Expr<'a>> { 785
786 pub fn initializer(self) -> Option<Expr<'a>> {
770 super::child_opt(self) 787 super::child_opt(self)
771 } 788 }
772} 789}
@@ -805,7 +822,8 @@ impl<'a> AstNode<'a> for LifetimeParam<'a> {
805 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 822 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
806} 823}
807 824
808impl<'a> LifetimeParam<'a> {pub fn lifetime(self) -> Option<Lifetime<'a>> { 825impl<'a> LifetimeParam<'a> {
826 pub fn lifetime(self) -> Option<Lifetime<'a>> {
809 super::child_opt(self) 827 super::child_opt(self)
810 } 828 }
811} 829}
@@ -867,10 +885,12 @@ impl<'a> MatchArm<'a> {
867 pub fn pats(self) -> impl Iterator<Item = Pat<'a>> + 'a { 885 pub fn pats(self) -> impl Iterator<Item = Pat<'a>> + 'a {
868 super::children(self) 886 super::children(self)
869 } 887 }
870pub fn guard(self) -> Option<MatchGuard<'a>> { 888
889 pub fn guard(self) -> Option<MatchGuard<'a>> {
871 super::child_opt(self) 890 super::child_opt(self)
872 } 891 }
873pub fn expr(self) -> Option<Expr<'a>> { 892
893 pub fn expr(self) -> Option<Expr<'a>> {
874 super::child_opt(self) 894 super::child_opt(self)
875 } 895 }
876} 896}
@@ -913,10 +933,12 @@ impl<'a> AstNode<'a> for MatchExpr<'a> {
913 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 933 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
914} 934}
915 935
916impl<'a> MatchExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> { 936impl<'a> MatchExpr<'a> {
937 pub fn expr(self) -> Option<Expr<'a>> {
917 super::child_opt(self) 938 super::child_opt(self)
918 } 939 }
919pub fn match_arm_list(self) -> Option<MatchArmList<'a>> { 940
941 pub fn match_arm_list(self) -> Option<MatchArmList<'a>> {
920 super::child_opt(self) 942 super::child_opt(self)
921 } 943 }
922} 944}
@@ -956,7 +978,8 @@ impl<'a> AstNode<'a> for MethodCallExpr<'a> {
956} 978}
957 979
958impl<'a> ast::ArgListOwner<'a> for MethodCallExpr<'a> {} 980impl<'a> ast::ArgListOwner<'a> for MethodCallExpr<'a> {}
959impl<'a> MethodCallExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> { 981impl<'a> MethodCallExpr<'a> {
982 pub fn expr(self) -> Option<Expr<'a>> {
960 super::child_opt(self) 983 super::child_opt(self)
961 } 984 }
962} 985}
@@ -979,7 +1002,8 @@ impl<'a> AstNode<'a> for Module<'a> {
979 1002
980impl<'a> ast::NameOwner<'a> for Module<'a> {} 1003impl<'a> ast::NameOwner<'a> for Module<'a> {}
981impl<'a> ast::AttrsOwner<'a> for Module<'a> {} 1004impl<'a> ast::AttrsOwner<'a> for Module<'a> {}
982impl<'a> Module<'a> {pub fn item_list(self) -> Option<ItemList<'a>> { 1005impl<'a> Module<'a> {
1006 pub fn item_list(self) -> Option<ItemList<'a>> {
983 super::child_opt(self) 1007 super::child_opt(self)
984 } 1008 }
985} 1009}
@@ -1190,7 +1214,8 @@ impl<'a> AstNode<'a> for Param<'a> {
1190 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1214 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1191} 1215}
1192 1216
1193impl<'a> Param<'a> {pub fn pat(self) -> Option<Pat<'a>> { 1217impl<'a> Param<'a> {
1218 pub fn pat(self) -> Option<Pat<'a>> {
1194 super::child_opt(self) 1219 super::child_opt(self)
1195 } 1220 }
1196} 1221}
@@ -1215,7 +1240,8 @@ impl<'a> ParamList<'a> {
1215 pub fn params(self) -> impl Iterator<Item = Param<'a>> + 'a { 1240 pub fn params(self) -> impl Iterator<Item = Param<'a>> + 'a {
1216 super::children(self) 1241 super::children(self)
1217 } 1242 }
1218pub fn self_param(self) -> Option<SelfParam<'a>> { 1243
1244 pub fn self_param(self) -> Option<SelfParam<'a>> {
1219 super::child_opt(self) 1245 super::child_opt(self)
1220 } 1246 }
1221} 1247}
@@ -1321,7 +1347,8 @@ impl<'a> AstNode<'a> for Path<'a> {
1321 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1347 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1322} 1348}
1323 1349
1324impl<'a> Path<'a> {pub fn segment(self) -> Option<PathSegment<'a>> { 1350impl<'a> Path<'a> {
1351 pub fn segment(self) -> Option<PathSegment<'a>> {
1325 super::child_opt(self) 1352 super::child_opt(self)
1326 } 1353 }
1327} 1354}
@@ -1378,7 +1405,8 @@ impl<'a> AstNode<'a> for PathSegment<'a> {
1378 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 1405 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
1379} 1406}
1380 1407
1381impl<'a> PathSegment<'a> {pub fn name_ref(self) -> Option<NameRef<'a>> { 1408impl<'a> PathSegment<'a> {
1409 pub fn name_ref(self) -> Option<NameRef<'a>> {
1382 super::child_opt(self) 1410 super::child_opt(self)
1383 } 1411 }
1384} 1412}
@@ -2052,7 +2080,8 @@ impl<'a> AstNode<'a> for UseItem<'a> {
2052 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 2080 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
2053} 2081}
2054 2082
2055impl<'a> UseItem<'a> {pub fn use_tree(self) -> Option<UseTree<'a>> { 2083impl<'a> UseItem<'a> {
2084 pub fn use_tree(self) -> Option<UseTree<'a>> {
2056 super::child_opt(self) 2085 super::child_opt(self)
2057 } 2086 }
2058} 2087}
@@ -2073,10 +2102,12 @@ impl<'a> AstNode<'a> for UseTree<'a> {
2073 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 2102 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
2074} 2103}
2075 2104
2076impl<'a> UseTree<'a> {pub fn path(self) -> Option<Path<'a>> { 2105impl<'a> UseTree<'a> {
2106 pub fn path(self) -> Option<Path<'a>> {
2077 super::child_opt(self) 2107 super::child_opt(self)
2078 } 2108 }
2079pub fn use_tree_list(self) -> Option<UseTreeList<'a>> { 2109
2110 pub fn use_tree_list(self) -> Option<UseTreeList<'a>> {
2080 super::child_opt(self) 2111 super::child_opt(self)
2081 } 2112 }
2082} 2113}
@@ -2138,7 +2169,8 @@ impl<'a> AstNode<'a> for WhileExpr<'a> {
2138} 2169}
2139 2170
2140impl<'a> ast::LoopBodyOwner<'a> for WhileExpr<'a> {} 2171impl<'a> ast::LoopBodyOwner<'a> for WhileExpr<'a> {}
2141impl<'a> WhileExpr<'a> {pub fn condition(self) -> Option<Condition<'a>> { 2172impl<'a> WhileExpr<'a> {
2173 pub fn condition(self) -> Option<Condition<'a>> {
2142 super::child_opt(self) 2174 super::child_opt(self)
2143 } 2175 }
2144} 2176}
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index ceb2cd7e2..ffa9c4134 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -77,8 +77,7 @@ impl<'a> {{ node }}<'a> {
77{%- else -%} 77{%- else -%}
78{%- set method_name = m.0 -%} 78{%- set method_name = m.0 -%}
79{%- set ChildName = m.1 %} 79{%- set ChildName = m.1 %}
80{%- endif -%} 80{%- endif %}
81
82 pub fn {{ method_name }}(self) -> Option<{{ ChildName }}<'a>> { 81 pub fn {{ method_name }}(self) -> Option<{{ ChildName }}<'a>> {
83 super::child_opt(self) 82 super::child_opt(self)
84 } 83 }