diff options
Diffstat (limited to 'crates/ra_syntax')
124 files changed, 1920 insertions, 1908 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index fd426ece9..d536bb1e7 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -17,7 +17,7 @@ use crate::{ | |||
17 | 17 | ||
18 | pub use self::{ | 18 | pub use self::{ |
19 | expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp}, | 19 | expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp}, |
20 | generated::{nodes::*, tokens::*}, | 20 | generated::*, |
21 | node_ext::{ | 21 | node_ext::{ |
22 | AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents, | 22 | AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents, |
23 | StructKind, TypeBoundKind, VisibilityKind, | 23 | StructKind, TypeBoundKind, VisibilityKind, |
@@ -287,7 +287,7 @@ where | |||
287 | 287 | ||
288 | assert!(pred.for_token().is_none()); | 288 | assert!(pred.for_token().is_none()); |
289 | assert!(pred.generic_param_list().is_none()); | 289 | assert!(pred.generic_param_list().is_none()); |
290 | assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); | 290 | assert_eq!("T", pred.ty().unwrap().syntax().text().to_string()); |
291 | assert_bound("Clone", bounds.next()); | 291 | assert_bound("Clone", bounds.next()); |
292 | assert_bound("Copy", bounds.next()); | 292 | assert_bound("Copy", bounds.next()); |
293 | assert_bound("Debug", bounds.next()); | 293 | assert_bound("Debug", bounds.next()); |
@@ -304,20 +304,20 @@ where | |||
304 | let pred = predicates.next().unwrap(); | 304 | let pred = predicates.next().unwrap(); |
305 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 305 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
306 | 306 | ||
307 | assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string()); | 307 | assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string()); |
308 | assert_bound("'a", bounds.next()); | 308 | assert_bound("'a", bounds.next()); |
309 | 309 | ||
310 | let pred = predicates.next().unwrap(); | 310 | let pred = predicates.next().unwrap(); |
311 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 311 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
312 | 312 | ||
313 | assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string()); | 313 | assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string()); |
314 | assert_bound("Debug", bounds.next()); | 314 | assert_bound("Debug", bounds.next()); |
315 | assert_bound("'a", bounds.next()); | 315 | assert_bound("'a", bounds.next()); |
316 | 316 | ||
317 | let pred = predicates.next().unwrap(); | 317 | let pred = predicates.next().unwrap(); |
318 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 318 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
319 | 319 | ||
320 | assert_eq!("<T as Iterator>::Item", pred.type_ref().unwrap().syntax().text().to_string()); | 320 | assert_eq!("<T as Iterator>::Item", pred.ty().unwrap().syntax().text().to_string()); |
321 | assert_bound("Debug", bounds.next()); | 321 | assert_bound("Debug", bounds.next()); |
322 | assert_bound("'a", bounds.next()); | 322 | assert_bound("'a", bounds.next()); |
323 | 323 | ||
@@ -326,6 +326,6 @@ where | |||
326 | 326 | ||
327 | assert!(pred.for_token().is_some()); | 327 | assert!(pred.for_token().is_some()); |
328 | assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string()); | 328 | assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string()); |
329 | assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); | 329 | assert_eq!("F", pred.ty().unwrap().syntax().text().to_string()); |
330 | assert_bound("Fn(&'a str)", bounds.next()); | 330 | assert_bound("Fn(&'a str)", bounds.next()); |
331 | } | 331 | } |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 8d3e42f25..667a9294f 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -237,17 +237,17 @@ impl ast::Path { | |||
237 | 237 | ||
238 | impl ast::PathSegment { | 238 | impl ast::PathSegment { |
239 | #[must_use] | 239 | #[must_use] |
240 | pub fn with_type_args(&self, type_args: ast::TypeArgList) -> ast::PathSegment { | 240 | pub fn with_type_args(&self, type_args: ast::GenericArgList) -> ast::PathSegment { |
241 | self._with_type_args(type_args, false) | 241 | self._with_type_args(type_args, false) |
242 | } | 242 | } |
243 | 243 | ||
244 | #[must_use] | 244 | #[must_use] |
245 | pub fn with_turbo_fish(&self, type_args: ast::TypeArgList) -> ast::PathSegment { | 245 | pub fn with_turbo_fish(&self, type_args: ast::GenericArgList) -> ast::PathSegment { |
246 | self._with_type_args(type_args, true) | 246 | self._with_type_args(type_args, true) |
247 | } | 247 | } |
248 | 248 | ||
249 | fn _with_type_args(&self, type_args: ast::TypeArgList, turbo: bool) -> ast::PathSegment { | 249 | fn _with_type_args(&self, type_args: ast::GenericArgList, turbo: bool) -> ast::PathSegment { |
250 | if let Some(old) = self.type_arg_list() { | 250 | if let Some(old) = self.generic_arg_list() { |
251 | return self.replace_children( | 251 | return self.replace_children( |
252 | single_node(old.syntax().clone()), | 252 | single_node(old.syntax().clone()), |
253 | iter::once(type_args.syntax().clone().into()), | 253 | iter::once(type_args.syntax().clone().into()), |
@@ -390,7 +390,7 @@ impl ast::MatchArmList { | |||
390 | #[must_use] | 390 | #[must_use] |
391 | pub fn remove_placeholder(&self) -> ast::MatchArmList { | 391 | pub fn remove_placeholder(&self) -> ast::MatchArmList { |
392 | let placeholder = | 392 | let placeholder = |
393 | self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::PlaceholderPat(_)))); | 393 | self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::WildcardPat(_)))); |
394 | if let Some(placeholder) = placeholder { | 394 | if let Some(placeholder) = placeholder { |
395 | self.remove_arm(&placeholder) | 395 | self.remove_arm(&placeholder) |
396 | } else { | 396 | } else { |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index f5199e09f..4a6f41ee7 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1,6 +1,41 @@ | |||
1 | //! This file is actually hand-written, but the submodules are indeed generated. | 1 | //! This file is actually hand-written, but the submodules are indeed generated. |
2 | |||
3 | #[rustfmt::skip] | 2 | #[rustfmt::skip] |
4 | pub(super) mod nodes; | 3 | mod nodes; |
5 | #[rustfmt::skip] | 4 | #[rustfmt::skip] |
6 | pub(super) mod tokens; | 5 | mod tokens; |
6 | |||
7 | use crate::{ | ||
8 | AstNode, | ||
9 | SyntaxKind::{self, *}, | ||
10 | SyntaxNode, | ||
11 | }; | ||
12 | |||
13 | pub use {nodes::*, tokens::*}; | ||
14 | |||
15 | // Stmt is the only nested enum, so it's easier to just hand-write it | ||
16 | impl AstNode for Stmt { | ||
17 | fn can_cast(kind: SyntaxKind) -> bool { | ||
18 | match kind { | ||
19 | LET_STMT | EXPR_STMT => true, | ||
20 | _ => Item::can_cast(kind), | ||
21 | } | ||
22 | } | ||
23 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
24 | let res = match syntax.kind() { | ||
25 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), | ||
26 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), | ||
27 | _ => { | ||
28 | let item = Item::cast(syntax)?; | ||
29 | Stmt::Item(item) | ||
30 | } | ||
31 | }; | ||
32 | Some(res) | ||
33 | } | ||
34 | fn syntax(&self) -> &SyntaxNode { | ||
35 | match self { | ||
36 | Stmt::LetStmt(it) => &it.syntax, | ||
37 | Stmt::ExprStmt(it) => &it.syntax, | ||
38 | Stmt::Item(it) => it.syntax(), | ||
39 | } | ||
40 | } | ||
41 | } | ||
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 4306efe13..3d49309d1 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -6,13 +6,133 @@ use crate::{ | |||
6 | SyntaxNode, SyntaxToken, T, | 6 | SyntaxNode, SyntaxToken, T, |
7 | }; | 7 | }; |
8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
9 | pub struct SourceFile { | 9 | pub struct Name { |
10 | pub(crate) syntax: SyntaxNode, | 10 | pub(crate) syntax: SyntaxNode, |
11 | } | 11 | } |
12 | impl ast::AttrsOwner for SourceFile {} | 12 | impl Name { |
13 | impl ast::ModuleItemOwner for SourceFile {} | 13 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
14 | impl SourceFile { | 14 | } |
15 | pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } | 15 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
16 | pub struct NameRef { | ||
17 | pub(crate) syntax: SyntaxNode, | ||
18 | } | ||
19 | impl NameRef { | ||
20 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
21 | } | ||
22 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
23 | pub struct Path { | ||
24 | pub(crate) syntax: SyntaxNode, | ||
25 | } | ||
26 | impl Path { | ||
27 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
28 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
29 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
30 | } | ||
31 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
32 | pub struct PathSegment { | ||
33 | pub(crate) syntax: SyntaxNode, | ||
34 | } | ||
35 | impl PathSegment { | ||
36 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
37 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
38 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
39 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
40 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
41 | pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } | ||
42 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
43 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
44 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
45 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | ||
46 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
47 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
48 | } | ||
49 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
50 | pub struct GenericArgList { | ||
51 | pub(crate) syntax: SyntaxNode, | ||
52 | } | ||
53 | impl GenericArgList { | ||
54 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
55 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
56 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } | ||
57 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
58 | } | ||
59 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
60 | pub struct ParamList { | ||
61 | pub(crate) syntax: SyntaxNode, | ||
62 | } | ||
63 | impl ParamList { | ||
64 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
65 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | ||
66 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } | ||
67 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
68 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
69 | } | ||
70 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
71 | pub struct RetType { | ||
72 | pub(crate) syntax: SyntaxNode, | ||
73 | } | ||
74 | impl RetType { | ||
75 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } | ||
76 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
77 | } | ||
78 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
79 | pub struct PathType { | ||
80 | pub(crate) syntax: SyntaxNode, | ||
81 | } | ||
82 | impl PathType { | ||
83 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
84 | } | ||
85 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
86 | pub struct TypeArg { | ||
87 | pub(crate) syntax: SyntaxNode, | ||
88 | } | ||
89 | impl TypeArg { | ||
90 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
91 | } | ||
92 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
93 | pub struct AssocTypeArg { | ||
94 | pub(crate) syntax: SyntaxNode, | ||
95 | } | ||
96 | impl ast::TypeBoundsOwner for AssocTypeArg {} | ||
97 | impl AssocTypeArg { | ||
98 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
99 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
100 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
101 | } | ||
102 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
103 | pub struct LifetimeArg { | ||
104 | pub(crate) syntax: SyntaxNode, | ||
105 | } | ||
106 | impl LifetimeArg { | ||
107 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
108 | support::token(&self.syntax, T![lifetime]) | ||
109 | } | ||
110 | } | ||
111 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
112 | pub struct ConstArg { | ||
113 | pub(crate) syntax: SyntaxNode, | ||
114 | } | ||
115 | impl ConstArg { | ||
116 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
117 | } | ||
118 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
119 | pub struct TypeBoundList { | ||
120 | pub(crate) syntax: SyntaxNode, | ||
121 | } | ||
122 | impl TypeBoundList { | ||
123 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | ||
124 | } | ||
125 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
126 | pub struct MacroCall { | ||
127 | pub(crate) syntax: SyntaxNode, | ||
128 | } | ||
129 | impl ast::AttrsOwner for MacroCall {} | ||
130 | impl ast::NameOwner for MacroCall {} | ||
131 | impl MacroCall { | ||
132 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
133 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
134 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
135 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
16 | } | 136 | } |
17 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 137 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
18 | pub struct Attr { | 138 | pub struct Attr { |
@@ -29,6 +149,41 @@ impl Attr { | |||
29 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 149 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
30 | } | 150 | } |
31 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
152 | pub struct TokenTree { | ||
153 | pub(crate) syntax: SyntaxNode, | ||
154 | } | ||
155 | impl TokenTree { | ||
156 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
157 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
158 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
159 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
160 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
161 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
162 | } | ||
163 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
164 | pub struct MacroItems { | ||
165 | pub(crate) syntax: SyntaxNode, | ||
166 | } | ||
167 | impl ast::ModuleItemOwner for MacroItems {} | ||
168 | impl MacroItems {} | ||
169 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
170 | pub struct MacroStmts { | ||
171 | pub(crate) syntax: SyntaxNode, | ||
172 | } | ||
173 | impl MacroStmts { | ||
174 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
175 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
176 | } | ||
177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
178 | pub struct SourceFile { | ||
179 | pub(crate) syntax: SyntaxNode, | ||
180 | } | ||
181 | impl ast::AttrsOwner for SourceFile {} | ||
182 | impl ast::ModuleItemOwner for SourceFile {} | ||
183 | impl SourceFile { | ||
184 | pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } | ||
185 | } | ||
186 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
32 | pub struct Const { | 187 | pub struct Const { |
33 | pub(crate) syntax: SyntaxNode, | 188 | pub(crate) syntax: SyntaxNode, |
34 | } | 189 | } |
@@ -40,7 +195,7 @@ impl Const { | |||
40 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 195 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
41 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 196 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
42 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 197 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
43 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 198 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
44 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 199 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
45 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 200 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
46 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 201 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
@@ -112,24 +267,11 @@ impl Impl { | |||
112 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 267 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
113 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | 268 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
114 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 269 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
115 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
116 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 270 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
117 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 271 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
118 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } | 272 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
119 | } | 273 | } |
120 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 274 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
121 | pub struct MacroCall { | ||
122 | pub(crate) syntax: SyntaxNode, | ||
123 | } | ||
124 | impl ast::AttrsOwner for MacroCall {} | ||
125 | impl ast::NameOwner for MacroCall {} | ||
126 | impl MacroCall { | ||
127 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
128 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
129 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
130 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
131 | } | ||
132 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
133 | pub struct Module { | 275 | pub struct Module { |
134 | pub(crate) syntax: SyntaxNode, | 276 | pub(crate) syntax: SyntaxNode, |
135 | } | 277 | } |
@@ -152,7 +294,7 @@ impl Static { | |||
152 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | 294 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
153 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 295 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
154 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 296 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
155 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 297 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
156 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 298 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
157 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 299 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
158 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 300 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
@@ -198,7 +340,7 @@ impl TypeAlias { | |||
198 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 340 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
199 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } | 341 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } |
200 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 342 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
201 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 343 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
202 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 344 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
203 | } | 345 | } |
204 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 346 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -239,13 +381,6 @@ impl Visibility { | |||
239 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 381 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
240 | } | 382 | } |
241 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 383 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
242 | pub struct Name { | ||
243 | pub(crate) syntax: SyntaxNode, | ||
244 | } | ||
245 | impl Name { | ||
246 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
247 | } | ||
248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
249 | pub struct ItemList { | 384 | pub struct ItemList { |
250 | pub(crate) syntax: SyntaxNode, | 385 | pub(crate) syntax: SyntaxNode, |
251 | } | 386 | } |
@@ -256,13 +391,6 @@ impl ItemList { | |||
256 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 391 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
257 | } | 392 | } |
258 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 393 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
259 | pub struct NameRef { | ||
260 | pub(crate) syntax: SyntaxNode, | ||
261 | } | ||
262 | impl NameRef { | ||
263 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } | ||
264 | } | ||
265 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
266 | pub struct Rename { | 394 | pub struct Rename { |
267 | pub(crate) syntax: SyntaxNode, | 395 | pub(crate) syntax: SyntaxNode, |
268 | } | 396 | } |
@@ -283,15 +411,6 @@ impl UseTree { | |||
283 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } | 411 | pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } |
284 | } | 412 | } |
285 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 413 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
286 | pub struct Path { | ||
287 | pub(crate) syntax: SyntaxNode, | ||
288 | } | ||
289 | impl Path { | ||
290 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | ||
291 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | ||
292 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | ||
293 | } | ||
294 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
295 | pub struct UseTreeList { | 414 | pub struct UseTreeList { |
296 | pub(crate) syntax: SyntaxNode, | 415 | pub(crate) syntax: SyntaxNode, |
297 | } | 416 | } |
@@ -317,25 +436,6 @@ impl GenericParamList { | |||
317 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | 436 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
318 | } | 437 | } |
319 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 438 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
320 | pub struct ParamList { | ||
321 | pub(crate) syntax: SyntaxNode, | ||
322 | } | ||
323 | impl ParamList { | ||
324 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
325 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | ||
326 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } | ||
327 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | ||
328 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
329 | } | ||
330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
331 | pub struct RetType { | ||
332 | pub(crate) syntax: SyntaxNode, | ||
333 | } | ||
334 | impl RetType { | ||
335 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } | ||
336 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
337 | } | ||
338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
339 | pub struct WhereClause { | 439 | pub struct WhereClause { |
340 | pub(crate) syntax: SyntaxNode, | 440 | pub(crate) syntax: SyntaxNode, |
341 | } | 441 | } |
@@ -348,9 +448,7 @@ pub struct BlockExpr { | |||
348 | pub(crate) syntax: SyntaxNode, | 448 | pub(crate) syntax: SyntaxNode, |
349 | } | 449 | } |
350 | impl ast::AttrsOwner for BlockExpr {} | 450 | impl ast::AttrsOwner for BlockExpr {} |
351 | impl ast::ModuleItemOwner for BlockExpr {} | ||
352 | impl BlockExpr { | 451 | impl BlockExpr { |
353 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
354 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 452 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
355 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 453 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
356 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 454 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
@@ -369,7 +467,7 @@ impl SelfParam { | |||
369 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 467 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
370 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | 468 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } |
371 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 469 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
372 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 470 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
373 | } | 471 | } |
374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 472 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
375 | pub struct Param { | 473 | pub struct Param { |
@@ -379,17 +477,10 @@ impl ast::AttrsOwner for Param {} | |||
379 | impl Param { | 477 | impl Param { |
380 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 478 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
381 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 479 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
382 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 480 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
383 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | 481 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } |
384 | } | 482 | } |
385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 483 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
386 | pub struct TypeBoundList { | ||
387 | pub(crate) syntax: SyntaxNode, | ||
388 | } | ||
389 | impl TypeBoundList { | ||
390 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | ||
391 | } | ||
392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
393 | pub struct RecordFieldList { | 484 | pub struct RecordFieldList { |
394 | pub(crate) syntax: SyntaxNode, | 485 | pub(crate) syntax: SyntaxNode, |
395 | } | 486 | } |
@@ -416,7 +507,7 @@ impl ast::NameOwner for RecordField {} | |||
416 | impl ast::VisibilityOwner for RecordField {} | 507 | impl ast::VisibilityOwner for RecordField {} |
417 | impl RecordField { | 508 | impl RecordField { |
418 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 509 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
419 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 510 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
420 | } | 511 | } |
421 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 512 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
422 | pub struct TupleField { | 513 | pub struct TupleField { |
@@ -425,7 +516,7 @@ pub struct TupleField { | |||
425 | impl ast::AttrsOwner for TupleField {} | 516 | impl ast::AttrsOwner for TupleField {} |
426 | impl ast::VisibilityOwner for TupleField {} | 517 | impl ast::VisibilityOwner for TupleField {} |
427 | impl TupleField { | 518 | impl TupleField { |
428 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 519 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
429 | } | 520 | } |
430 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 521 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
431 | pub struct VariantList { | 522 | pub struct VariantList { |
@@ -469,10 +560,24 @@ impl ExternItemList { | |||
469 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 560 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
470 | } | 561 | } |
471 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 562 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
563 | pub struct ConstParam { | ||
564 | pub(crate) syntax: SyntaxNode, | ||
565 | } | ||
566 | impl ast::AttrsOwner for ConstParam {} | ||
567 | impl ast::NameOwner for ConstParam {} | ||
568 | impl ConstParam { | ||
569 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
570 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
571 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
572 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
573 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
574 | } | ||
575 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
472 | pub struct LifetimeParam { | 576 | pub struct LifetimeParam { |
473 | pub(crate) syntax: SyntaxNode, | 577 | pub(crate) syntax: SyntaxNode, |
474 | } | 578 | } |
475 | impl ast::AttrsOwner for LifetimeParam {} | 579 | impl ast::AttrsOwner for LifetimeParam {} |
580 | impl ast::TypeBoundsOwner for LifetimeParam {} | ||
476 | impl LifetimeParam { | 581 | impl LifetimeParam { |
477 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 582 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
478 | support::token(&self.syntax, T![lifetime]) | 583 | support::token(&self.syntax, T![lifetime]) |
@@ -487,200 +592,124 @@ impl ast::NameOwner for TypeParam {} | |||
487 | impl ast::TypeBoundsOwner for TypeParam {} | 592 | impl ast::TypeBoundsOwner for TypeParam {} |
488 | impl TypeParam { | 593 | impl TypeParam { |
489 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 594 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
490 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 595 | pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } |
491 | } | 596 | } |
492 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 597 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
493 | pub struct ConstParam { | 598 | pub struct WherePred { |
494 | pub(crate) syntax: SyntaxNode, | 599 | pub(crate) syntax: SyntaxNode, |
495 | } | 600 | } |
496 | impl ast::AttrsOwner for ConstParam {} | 601 | impl ast::TypeBoundsOwner for WherePred {} |
497 | impl ast::NameOwner for ConstParam {} | 602 | impl WherePred { |
498 | impl ConstParam { | 603 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
499 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 604 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } |
500 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 605 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
501 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 606 | support::token(&self.syntax, T![lifetime]) |
502 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 607 | } |
503 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | 608 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
504 | } | 609 | } |
505 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 610 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
506 | pub struct Literal { | 611 | pub struct Literal { |
507 | pub(crate) syntax: SyntaxNode, | 612 | pub(crate) syntax: SyntaxNode, |
508 | } | 613 | } |
614 | impl ast::AttrsOwner for Literal {} | ||
509 | impl Literal {} | 615 | impl Literal {} |
510 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 616 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
511 | pub struct TokenTree { | 617 | pub struct ExprStmt { |
512 | pub(crate) syntax: SyntaxNode, | ||
513 | } | ||
514 | impl TokenTree { | ||
515 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
516 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
517 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
518 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
519 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
520 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
521 | } | ||
522 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
523 | pub struct ParenType { | ||
524 | pub(crate) syntax: SyntaxNode, | 618 | pub(crate) syntax: SyntaxNode, |
525 | } | 619 | } |
526 | impl ParenType { | 620 | impl ast::AttrsOwner for ExprStmt {} |
527 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 621 | impl ExprStmt { |
528 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 622 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
529 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 623 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
530 | } | 624 | } |
531 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 625 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
532 | pub struct TupleType { | 626 | pub struct LetStmt { |
533 | pub(crate) syntax: SyntaxNode, | 627 | pub(crate) syntax: SyntaxNode, |
534 | } | 628 | } |
535 | impl TupleType { | 629 | impl ast::AttrsOwner for LetStmt {} |
536 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 630 | impl LetStmt { |
537 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } | 631 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
538 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 632 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
633 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
634 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
635 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
636 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
637 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
539 | } | 638 | } |
540 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 639 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
541 | pub struct NeverType { | 640 | pub struct ArrayExpr { |
542 | pub(crate) syntax: SyntaxNode, | 641 | pub(crate) syntax: SyntaxNode, |
543 | } | 642 | } |
544 | impl NeverType { | 643 | impl ast::AttrsOwner for ArrayExpr {} |
545 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 644 | impl ArrayExpr { |
645 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
646 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
647 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
648 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
649 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
546 | } | 650 | } |
547 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 651 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
548 | pub struct PathType { | 652 | pub struct AwaitExpr { |
549 | pub(crate) syntax: SyntaxNode, | 653 | pub(crate) syntax: SyntaxNode, |
550 | } | 654 | } |
551 | impl PathType { | 655 | impl ast::AttrsOwner for AwaitExpr {} |
552 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 656 | impl AwaitExpr { |
657 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
658 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
659 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
553 | } | 660 | } |
554 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 661 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
555 | pub struct PointerType { | 662 | pub struct BinExpr { |
556 | pub(crate) syntax: SyntaxNode, | 663 | pub(crate) syntax: SyntaxNode, |
557 | } | 664 | } |
558 | impl PointerType { | 665 | impl ast::AttrsOwner for BinExpr {} |
559 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | 666 | impl BinExpr {} |
560 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
561 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
562 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
563 | } | ||
564 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 667 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
565 | pub struct ArrayType { | 668 | pub struct BoxExpr { |
566 | pub(crate) syntax: SyntaxNode, | 669 | pub(crate) syntax: SyntaxNode, |
567 | } | 670 | } |
568 | impl ArrayType { | 671 | impl ast::AttrsOwner for BoxExpr {} |
569 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 672 | impl BoxExpr { |
570 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 673 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
571 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
572 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 674 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
573 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
574 | } | 675 | } |
575 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 676 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
576 | pub struct SliceType { | 677 | pub struct BreakExpr { |
577 | pub(crate) syntax: SyntaxNode, | ||
578 | } | ||
579 | impl SliceType { | ||
580 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
581 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
582 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
583 | } | ||
584 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
585 | pub struct ReferenceType { | ||
586 | pub(crate) syntax: SyntaxNode, | 678 | pub(crate) syntax: SyntaxNode, |
587 | } | 679 | } |
588 | impl ReferenceType { | 680 | impl ast::AttrsOwner for BreakExpr {} |
589 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 681 | impl BreakExpr { |
682 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } | ||
590 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 683 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
591 | support::token(&self.syntax, T![lifetime]) | 684 | support::token(&self.syntax, T![lifetime]) |
592 | } | 685 | } |
593 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
594 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
595 | } | ||
596 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
597 | pub struct PlaceholderType { | ||
598 | pub(crate) syntax: SyntaxNode, | ||
599 | } | ||
600 | impl PlaceholderType { | ||
601 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
602 | } | ||
603 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
604 | pub struct FnPointerType { | ||
605 | pub(crate) syntax: SyntaxNode, | ||
606 | } | ||
607 | impl FnPointerType { | ||
608 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
609 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
610 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
611 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
612 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
613 | } | ||
614 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
615 | pub struct ForType { | ||
616 | pub(crate) syntax: SyntaxNode, | ||
617 | } | ||
618 | impl ForType { | ||
619 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
620 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } | ||
621 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
622 | } | ||
623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
624 | pub struct ImplTraitType { | ||
625 | pub(crate) syntax: SyntaxNode, | ||
626 | } | ||
627 | impl ImplTraitType { | ||
628 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | ||
629 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } | ||
630 | } | ||
631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
632 | pub struct DynTraitType { | ||
633 | pub(crate) syntax: SyntaxNode, | ||
634 | } | ||
635 | impl DynTraitType { | ||
636 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } | ||
637 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } | ||
638 | } | ||
639 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
640 | pub struct TupleExpr { | ||
641 | pub(crate) syntax: SyntaxNode, | ||
642 | } | ||
643 | impl ast::AttrsOwner for TupleExpr {} | ||
644 | impl TupleExpr { | ||
645 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
646 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
647 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
648 | } | ||
649 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
650 | pub struct ArrayExpr { | ||
651 | pub(crate) syntax: SyntaxNode, | ||
652 | } | ||
653 | impl ast::AttrsOwner for ArrayExpr {} | ||
654 | impl ArrayExpr { | ||
655 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
656 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
657 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 686 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
658 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
659 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
660 | } | 687 | } |
661 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
662 | pub struct ParenExpr { | 689 | pub struct CallExpr { |
663 | pub(crate) syntax: SyntaxNode, | 690 | pub(crate) syntax: SyntaxNode, |
664 | } | 691 | } |
665 | impl ast::AttrsOwner for ParenExpr {} | 692 | impl ast::AttrsOwner for CallExpr {} |
666 | impl ParenExpr { | 693 | impl ast::ArgListOwner for CallExpr {} |
667 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 694 | impl CallExpr { |
668 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 695 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
669 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
670 | } | 696 | } |
671 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 697 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
672 | pub struct PathExpr { | 698 | pub struct CastExpr { |
673 | pub(crate) syntax: SyntaxNode, | 699 | pub(crate) syntax: SyntaxNode, |
674 | } | 700 | } |
675 | impl PathExpr { | 701 | impl ast::AttrsOwner for CastExpr {} |
676 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 702 | impl CastExpr { |
703 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
704 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
705 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
677 | } | 706 | } |
678 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 707 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
679 | pub struct LambdaExpr { | 708 | pub struct ClosureExpr { |
680 | pub(crate) syntax: SyntaxNode, | 709 | pub(crate) syntax: SyntaxNode, |
681 | } | 710 | } |
682 | impl ast::AttrsOwner for LambdaExpr {} | 711 | impl ast::AttrsOwner for ClosureExpr {} |
683 | impl LambdaExpr { | 712 | impl ClosureExpr { |
684 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | 713 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
685 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 714 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
686 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | 715 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } |
@@ -689,23 +718,17 @@ impl LambdaExpr { | |||
689 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 718 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
690 | } | 719 | } |
691 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 720 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
692 | pub struct IfExpr { | 721 | pub struct ContinueExpr { |
693 | pub(crate) syntax: SyntaxNode, | ||
694 | } | ||
695 | impl ast::AttrsOwner for IfExpr {} | ||
696 | impl IfExpr { | ||
697 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
698 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
699 | } | ||
700 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
701 | pub struct Condition { | ||
702 | pub(crate) syntax: SyntaxNode, | 722 | pub(crate) syntax: SyntaxNode, |
703 | } | 723 | } |
704 | impl Condition { | 724 | impl ast::AttrsOwner for ContinueExpr {} |
705 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | 725 | impl ContinueExpr { |
706 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 726 | pub fn continue_token(&self) -> Option<SyntaxToken> { |
707 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 727 | support::token(&self.syntax, T![continue]) |
708 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 728 | } |
729 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
730 | support::token(&self.syntax, T![lifetime]) | ||
731 | } | ||
709 | } | 732 | } |
710 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 733 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
711 | pub struct EffectExpr { | 734 | pub struct EffectExpr { |
@@ -720,22 +743,14 @@ impl EffectExpr { | |||
720 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 743 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
721 | } | 744 | } |
722 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
723 | pub struct Label { | 746 | pub struct FieldExpr { |
724 | pub(crate) syntax: SyntaxNode, | ||
725 | } | ||
726 | impl Label { | ||
727 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
728 | support::token(&self.syntax, T![lifetime]) | ||
729 | } | ||
730 | } | ||
731 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
732 | pub struct LoopExpr { | ||
733 | pub(crate) syntax: SyntaxNode, | 747 | pub(crate) syntax: SyntaxNode, |
734 | } | 748 | } |
735 | impl ast::AttrsOwner for LoopExpr {} | 749 | impl ast::AttrsOwner for FieldExpr {} |
736 | impl ast::LoopBodyOwner for LoopExpr {} | 750 | impl FieldExpr { |
737 | impl LoopExpr { | 751 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
738 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } | 752 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
753 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
739 | } | 754 | } |
740 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 755 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
741 | pub struct ForExpr { | 756 | pub struct ForExpr { |
@@ -750,120 +765,117 @@ impl ForExpr { | |||
750 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | 765 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } |
751 | } | 766 | } |
752 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 767 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
753 | pub struct WhileExpr { | 768 | pub struct IfExpr { |
754 | pub(crate) syntax: SyntaxNode, | 769 | pub(crate) syntax: SyntaxNode, |
755 | } | 770 | } |
756 | impl ast::AttrsOwner for WhileExpr {} | 771 | impl ast::AttrsOwner for IfExpr {} |
757 | impl ast::LoopBodyOwner for WhileExpr {} | 772 | impl IfExpr { |
758 | impl WhileExpr { | 773 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
759 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } | ||
760 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 774 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
775 | pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } | ||
761 | } | 776 | } |
762 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 777 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
763 | pub struct ContinueExpr { | 778 | pub struct IndexExpr { |
764 | pub(crate) syntax: SyntaxNode, | 779 | pub(crate) syntax: SyntaxNode, |
765 | } | 780 | } |
766 | impl ast::AttrsOwner for ContinueExpr {} | 781 | impl ast::AttrsOwner for IndexExpr {} |
767 | impl ContinueExpr { | 782 | impl IndexExpr { |
768 | pub fn continue_token(&self) -> Option<SyntaxToken> { | 783 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
769 | support::token(&self.syntax, T![continue]) | 784 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
770 | } | ||
771 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
772 | support::token(&self.syntax, T![lifetime]) | ||
773 | } | ||
774 | } | 785 | } |
775 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 786 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
776 | pub struct BreakExpr { | 787 | pub struct LoopExpr { |
777 | pub(crate) syntax: SyntaxNode, | 788 | pub(crate) syntax: SyntaxNode, |
778 | } | 789 | } |
779 | impl ast::AttrsOwner for BreakExpr {} | 790 | impl ast::AttrsOwner for LoopExpr {} |
780 | impl BreakExpr { | 791 | impl ast::LoopBodyOwner for LoopExpr {} |
781 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } | 792 | impl LoopExpr { |
782 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 793 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } |
783 | support::token(&self.syntax, T![lifetime]) | ||
784 | } | ||
785 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
786 | } | 794 | } |
787 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 795 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
788 | pub struct ReturnExpr { | 796 | pub struct MatchExpr { |
789 | pub(crate) syntax: SyntaxNode, | 797 | pub(crate) syntax: SyntaxNode, |
790 | } | 798 | } |
791 | impl ast::AttrsOwner for ReturnExpr {} | 799 | impl ast::AttrsOwner for MatchExpr {} |
792 | impl ReturnExpr { | 800 | impl MatchExpr { |
793 | pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } | 801 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } |
794 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 802 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
803 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | ||
795 | } | 804 | } |
796 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 805 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
797 | pub struct CallExpr { | 806 | pub struct MethodCallExpr { |
798 | pub(crate) syntax: SyntaxNode, | 807 | pub(crate) syntax: SyntaxNode, |
799 | } | 808 | } |
800 | impl ast::AttrsOwner for CallExpr {} | 809 | impl ast::AttrsOwner for MethodCallExpr {} |
801 | impl ast::ArgListOwner for CallExpr {} | 810 | impl ast::ArgListOwner for MethodCallExpr {} |
802 | impl CallExpr { | 811 | impl MethodCallExpr { |
803 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 812 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
813 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
814 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
815 | pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } | ||
804 | } | 816 | } |
805 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 817 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
806 | pub struct ArgList { | 818 | pub struct ParenExpr { |
807 | pub(crate) syntax: SyntaxNode, | 819 | pub(crate) syntax: SyntaxNode, |
808 | } | 820 | } |
809 | impl ArgList { | 821 | impl ast::AttrsOwner for ParenExpr {} |
822 | impl ParenExpr { | ||
810 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 823 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
811 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 824 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
812 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 825 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
813 | } | 826 | } |
814 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 827 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
815 | pub struct MethodCallExpr { | 828 | pub struct PathExpr { |
816 | pub(crate) syntax: SyntaxNode, | 829 | pub(crate) syntax: SyntaxNode, |
817 | } | 830 | } |
818 | impl ast::AttrsOwner for MethodCallExpr {} | 831 | impl ast::AttrsOwner for PathExpr {} |
819 | impl ast::ArgListOwner for MethodCallExpr {} | 832 | impl PathExpr { |
820 | impl MethodCallExpr { | 833 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
821 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
822 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
823 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
824 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
825 | } | 834 | } |
826 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 835 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
827 | pub struct TypeArgList { | 836 | pub struct PrefixExpr { |
828 | pub(crate) syntax: SyntaxNode, | 837 | pub(crate) syntax: SyntaxNode, |
829 | } | 838 | } |
830 | impl TypeArgList { | 839 | impl ast::AttrsOwner for PrefixExpr {} |
831 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | 840 | impl PrefixExpr { |
832 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | 841 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
833 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } | ||
834 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } | ||
835 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } | ||
836 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } | ||
837 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
838 | } | 842 | } |
839 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 843 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
840 | pub struct FieldExpr { | 844 | pub struct RangeExpr { |
841 | pub(crate) syntax: SyntaxNode, | 845 | pub(crate) syntax: SyntaxNode, |
842 | } | 846 | } |
843 | impl ast::AttrsOwner for FieldExpr {} | 847 | impl ast::AttrsOwner for RangeExpr {} |
844 | impl FieldExpr { | 848 | impl RangeExpr {} |
845 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 849 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
846 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | 850 | pub struct RecordExpr { |
847 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 851 | pub(crate) syntax: SyntaxNode, |
852 | } | ||
853 | impl RecordExpr { | ||
854 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
855 | pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { | ||
856 | support::child(&self.syntax) | ||
857 | } | ||
848 | } | 858 | } |
849 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 859 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
850 | pub struct IndexExpr { | 860 | pub struct RefExpr { |
851 | pub(crate) syntax: SyntaxNode, | 861 | pub(crate) syntax: SyntaxNode, |
852 | } | 862 | } |
853 | impl ast::AttrsOwner for IndexExpr {} | 863 | impl ast::AttrsOwner for RefExpr {} |
854 | impl IndexExpr { | 864 | impl RefExpr { |
855 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 865 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
856 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 866 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } |
867 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
868 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
869 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
857 | } | 870 | } |
858 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 871 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
859 | pub struct AwaitExpr { | 872 | pub struct ReturnExpr { |
860 | pub(crate) syntax: SyntaxNode, | 873 | pub(crate) syntax: SyntaxNode, |
861 | } | 874 | } |
862 | impl ast::AttrsOwner for AwaitExpr {} | 875 | impl ast::AttrsOwner for ReturnExpr {} |
863 | impl AwaitExpr { | 876 | impl ReturnExpr { |
877 | pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } | ||
864 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 878 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
865 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
866 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
867 | } | 879 | } |
868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 880 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
869 | pub struct TryExpr { | 881 | pub struct TryExpr { |
@@ -875,70 +887,80 @@ impl TryExpr { | |||
875 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | 887 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } |
876 | } | 888 | } |
877 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 889 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
878 | pub struct CastExpr { | 890 | pub struct TupleExpr { |
879 | pub(crate) syntax: SyntaxNode, | 891 | pub(crate) syntax: SyntaxNode, |
880 | } | 892 | } |
881 | impl ast::AttrsOwner for CastExpr {} | 893 | impl ast::AttrsOwner for TupleExpr {} |
882 | impl CastExpr { | 894 | impl TupleExpr { |
883 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 895 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
884 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | 896 | pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
885 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 897 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
886 | } | 898 | } |
887 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 899 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
888 | pub struct RefExpr { | 900 | pub struct WhileExpr { |
889 | pub(crate) syntax: SyntaxNode, | 901 | pub(crate) syntax: SyntaxNode, |
890 | } | 902 | } |
891 | impl ast::AttrsOwner for RefExpr {} | 903 | impl ast::AttrsOwner for WhileExpr {} |
892 | impl RefExpr { | 904 | impl ast::LoopBodyOwner for WhileExpr {} |
893 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 905 | impl WhileExpr { |
894 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } | 906 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } |
895 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 907 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
896 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
897 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
898 | } | 908 | } |
899 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 909 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
900 | pub struct PrefixExpr { | 910 | pub struct Label { |
901 | pub(crate) syntax: SyntaxNode, | 911 | pub(crate) syntax: SyntaxNode, |
902 | } | 912 | } |
903 | impl ast::AttrsOwner for PrefixExpr {} | 913 | impl Label { |
904 | impl PrefixExpr { | 914 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
905 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 915 | support::token(&self.syntax, T![lifetime]) |
916 | } | ||
906 | } | 917 | } |
907 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 918 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
908 | pub struct BoxExpr { | 919 | pub struct RecordExprFieldList { |
909 | pub(crate) syntax: SyntaxNode, | 920 | pub(crate) syntax: SyntaxNode, |
910 | } | 921 | } |
911 | impl ast::AttrsOwner for BoxExpr {} | 922 | impl ast::AttrsOwner for RecordExprFieldList {} |
912 | impl BoxExpr { | 923 | impl RecordExprFieldList { |
913 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | 924 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
914 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 925 | pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } |
926 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
927 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
928 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
915 | } | 929 | } |
916 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 930 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
917 | pub struct RangeExpr { | 931 | pub struct RecordExprField { |
918 | pub(crate) syntax: SyntaxNode, | 932 | pub(crate) syntax: SyntaxNode, |
919 | } | 933 | } |
920 | impl ast::AttrsOwner for RangeExpr {} | 934 | impl ast::AttrsOwner for RecordExprField {} |
921 | impl RangeExpr {} | 935 | impl RecordExprField { |
936 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
937 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
938 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
939 | } | ||
922 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 940 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
923 | pub struct BinExpr { | 941 | pub struct ArgList { |
924 | pub(crate) syntax: SyntaxNode, | 942 | pub(crate) syntax: SyntaxNode, |
925 | } | 943 | } |
926 | impl ast::AttrsOwner for BinExpr {} | 944 | impl ArgList { |
927 | impl BinExpr {} | 945 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
946 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
947 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
948 | } | ||
928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 949 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
929 | pub struct MatchExpr { | 950 | pub struct Condition { |
930 | pub(crate) syntax: SyntaxNode, | 951 | pub(crate) syntax: SyntaxNode, |
931 | } | 952 | } |
932 | impl ast::AttrsOwner for MatchExpr {} | 953 | impl Condition { |
933 | impl MatchExpr { | 954 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
934 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } | 955 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
956 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
935 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 957 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
936 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | ||
937 | } | 958 | } |
938 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 959 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
939 | pub struct MatchArmList { | 960 | pub struct MatchArmList { |
940 | pub(crate) syntax: SyntaxNode, | 961 | pub(crate) syntax: SyntaxNode, |
941 | } | 962 | } |
963 | impl ast::AttrsOwner for MatchArmList {} | ||
942 | impl MatchArmList { | 964 | impl MatchArmList { |
943 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 965 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
944 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | 966 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } |
@@ -954,6 +976,7 @@ impl MatchArm { | |||
954 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | 976 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } |
955 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } | 977 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } |
956 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 978 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
979 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } | ||
957 | } | 980 | } |
958 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 981 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
959 | pub struct MatchGuard { | 982 | pub struct MatchGuard { |
@@ -964,304 +987,326 @@ impl MatchGuard { | |||
964 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 987 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
965 | } | 988 | } |
966 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 989 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
967 | pub struct RecordExpr { | 990 | pub struct ArrayType { |
968 | pub(crate) syntax: SyntaxNode, | ||
969 | } | ||
970 | impl RecordExpr { | ||
971 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
972 | pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { | ||
973 | support::child(&self.syntax) | ||
974 | } | ||
975 | } | ||
976 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
977 | pub struct RecordExprFieldList { | ||
978 | pub(crate) syntax: SyntaxNode, | 991 | pub(crate) syntax: SyntaxNode, |
979 | } | 992 | } |
980 | impl RecordExprFieldList { | 993 | impl ArrayType { |
981 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 994 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
982 | pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } | 995 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
983 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 996 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
984 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | 997 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
985 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 998 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
986 | } | 999 | } |
987 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1000 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
988 | pub struct RecordExprField { | 1001 | pub struct DynTraitType { |
989 | pub(crate) syntax: SyntaxNode, | 1002 | pub(crate) syntax: SyntaxNode, |
990 | } | 1003 | } |
991 | impl ast::AttrsOwner for RecordExprField {} | 1004 | impl DynTraitType { |
992 | impl RecordExprField { | 1005 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } |
993 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1006 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } |
994 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
995 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
996 | } | 1007 | } |
997 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1008 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
998 | pub struct OrPat { | 1009 | pub struct FnPtrType { |
999 | pub(crate) syntax: SyntaxNode, | 1010 | pub(crate) syntax: SyntaxNode, |
1000 | } | 1011 | } |
1001 | impl OrPat { | 1012 | impl FnPtrType { |
1002 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1013 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
1014 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
1015 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
1016 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
1017 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
1018 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
1019 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
1003 | } | 1020 | } |
1004 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1021 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1005 | pub struct ParenPat { | 1022 | pub struct ForType { |
1006 | pub(crate) syntax: SyntaxNode, | 1023 | pub(crate) syntax: SyntaxNode, |
1007 | } | 1024 | } |
1008 | impl ParenPat { | 1025 | impl ForType { |
1009 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1026 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
1010 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1027 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } |
1011 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1028 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
1012 | } | 1029 | } |
1013 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1014 | pub struct RefPat { | 1031 | pub struct ImplTraitType { |
1015 | pub(crate) syntax: SyntaxNode, | 1032 | pub(crate) syntax: SyntaxNode, |
1016 | } | 1033 | } |
1017 | impl RefPat { | 1034 | impl ImplTraitType { |
1018 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 1035 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
1019 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 1036 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } |
1020 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1021 | } | 1037 | } |
1022 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1038 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1023 | pub struct BoxPat { | 1039 | pub struct InferType { |
1024 | pub(crate) syntax: SyntaxNode, | 1040 | pub(crate) syntax: SyntaxNode, |
1025 | } | 1041 | } |
1026 | impl BoxPat { | 1042 | impl InferType { |
1027 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | 1043 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1028 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1029 | } | 1044 | } |
1030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1045 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1031 | pub struct BindPat { | 1046 | pub struct NeverType { |
1032 | pub(crate) syntax: SyntaxNode, | 1047 | pub(crate) syntax: SyntaxNode, |
1033 | } | 1048 | } |
1034 | impl ast::AttrsOwner for BindPat {} | 1049 | impl NeverType { |
1035 | impl ast::NameOwner for BindPat {} | 1050 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
1036 | impl BindPat { | ||
1037 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
1038 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1039 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1040 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1041 | } | 1051 | } |
1042 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1052 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1043 | pub struct PlaceholderPat { | 1053 | pub struct ParenType { |
1044 | pub(crate) syntax: SyntaxNode, | 1054 | pub(crate) syntax: SyntaxNode, |
1045 | } | 1055 | } |
1046 | impl PlaceholderPat { | 1056 | impl ParenType { |
1047 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1057 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1058 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1059 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1048 | } | 1060 | } |
1049 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1061 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1050 | pub struct DotDotPat { | 1062 | pub struct PtrType { |
1051 | pub(crate) syntax: SyntaxNode, | 1063 | pub(crate) syntax: SyntaxNode, |
1052 | } | 1064 | } |
1053 | impl DotDotPat { | 1065 | impl PtrType { |
1054 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1066 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
1067 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1068 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1069 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1055 | } | 1070 | } |
1056 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1071 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1057 | pub struct PathPat { | 1072 | pub struct RefType { |
1058 | pub(crate) syntax: SyntaxNode, | 1073 | pub(crate) syntax: SyntaxNode, |
1059 | } | 1074 | } |
1060 | impl PathPat { | 1075 | impl RefType { |
1061 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1076 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1077 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1078 | support::token(&self.syntax, T![lifetime]) | ||
1079 | } | ||
1080 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1081 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1062 | } | 1082 | } |
1063 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1083 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1064 | pub struct SlicePat { | 1084 | pub struct SliceType { |
1065 | pub(crate) syntax: SyntaxNode, | 1085 | pub(crate) syntax: SyntaxNode, |
1066 | } | 1086 | } |
1067 | impl SlicePat { | 1087 | impl SliceType { |
1068 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 1088 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1069 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1089 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
1070 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 1090 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1071 | } | 1091 | } |
1072 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1092 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1073 | pub struct RangePat { | 1093 | pub struct TupleType { |
1074 | pub(crate) syntax: SyntaxNode, | 1094 | pub(crate) syntax: SyntaxNode, |
1075 | } | 1095 | } |
1076 | impl RangePat { | 1096 | impl TupleType { |
1077 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1097 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1078 | pub fn dotdoteq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..=]) } | 1098 | pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) } |
1099 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1079 | } | 1100 | } |
1080 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1101 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1081 | pub struct LiteralPat { | 1102 | pub struct TypeBound { |
1082 | pub(crate) syntax: SyntaxNode, | 1103 | pub(crate) syntax: SyntaxNode, |
1083 | } | 1104 | } |
1084 | impl LiteralPat { | 1105 | impl TypeBound { |
1085 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 1106 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1107 | support::token(&self.syntax, T![lifetime]) | ||
1108 | } | ||
1109 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
1110 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1086 | } | 1111 | } |
1087 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1112 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1088 | pub struct MacroPat { | 1113 | pub struct IdentPat { |
1089 | pub(crate) syntax: SyntaxNode, | 1114 | pub(crate) syntax: SyntaxNode, |
1090 | } | 1115 | } |
1091 | impl MacroPat { | 1116 | impl ast::AttrsOwner for IdentPat {} |
1092 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | 1117 | impl ast::NameOwner for IdentPat {} |
1118 | impl IdentPat { | ||
1119 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } | ||
1120 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1121 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } | ||
1122 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1093 | } | 1123 | } |
1094 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1124 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1095 | pub struct RecordPat { | 1125 | pub struct BoxPat { |
1096 | pub(crate) syntax: SyntaxNode, | 1126 | pub(crate) syntax: SyntaxNode, |
1097 | } | 1127 | } |
1098 | impl RecordPat { | 1128 | impl BoxPat { |
1099 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1129 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
1100 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { | 1130 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1101 | support::child(&self.syntax) | ||
1102 | } | ||
1103 | } | 1131 | } |
1104 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1132 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1105 | pub struct RecordFieldPatList { | 1133 | pub struct RestPat { |
1106 | pub(crate) syntax: SyntaxNode, | 1134 | pub(crate) syntax: SyntaxNode, |
1107 | } | 1135 | } |
1108 | impl RecordFieldPatList { | 1136 | impl RestPat { |
1109 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1110 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | ||
1111 | support::children(&self.syntax) | ||
1112 | } | ||
1113 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | ||
1114 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1137 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1115 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1116 | } | 1138 | } |
1117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1139 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1118 | pub struct RecordFieldPat { | 1140 | pub struct LiteralPat { |
1119 | pub(crate) syntax: SyntaxNode, | 1141 | pub(crate) syntax: SyntaxNode, |
1120 | } | 1142 | } |
1121 | impl ast::AttrsOwner for RecordFieldPat {} | 1143 | impl LiteralPat { |
1122 | impl RecordFieldPat { | 1144 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
1123 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1124 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1125 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1126 | } | 1145 | } |
1127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1146 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1128 | pub struct TupleStructPat { | 1147 | pub struct MacroPat { |
1129 | pub(crate) syntax: SyntaxNode, | 1148 | pub(crate) syntax: SyntaxNode, |
1130 | } | 1149 | } |
1131 | impl TupleStructPat { | 1150 | impl MacroPat { |
1132 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1151 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } |
1133 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1134 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1135 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1136 | } | 1152 | } |
1137 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1153 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1138 | pub struct TuplePat { | 1154 | pub struct OrPat { |
1139 | pub(crate) syntax: SyntaxNode, | 1155 | pub(crate) syntax: SyntaxNode, |
1140 | } | 1156 | } |
1141 | impl TuplePat { | 1157 | impl OrPat { |
1142 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 1158 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1143 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1144 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1145 | } | 1159 | } |
1146 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1147 | pub struct MacroDef { | 1161 | pub struct ParenPat { |
1148 | pub(crate) syntax: SyntaxNode, | 1162 | pub(crate) syntax: SyntaxNode, |
1149 | } | 1163 | } |
1150 | impl ast::NameOwner for MacroDef {} | 1164 | impl ParenPat { |
1151 | impl MacroDef { | 1165 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1152 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | 1166 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1167 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1153 | } | 1168 | } |
1154 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1169 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1155 | pub struct MacroItems { | 1170 | pub struct PathPat { |
1156 | pub(crate) syntax: SyntaxNode, | 1171 | pub(crate) syntax: SyntaxNode, |
1157 | } | 1172 | } |
1158 | impl ast::ModuleItemOwner for MacroItems {} | 1173 | impl PathPat { |
1159 | impl MacroItems {} | 1174 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1175 | } | ||
1160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1176 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1161 | pub struct MacroStmts { | 1177 | pub struct WildcardPat { |
1162 | pub(crate) syntax: SyntaxNode, | 1178 | pub(crate) syntax: SyntaxNode, |
1163 | } | 1179 | } |
1164 | impl MacroStmts { | 1180 | impl WildcardPat { |
1165 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 1181 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1166 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1167 | } | 1182 | } |
1168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1169 | pub struct TypeBound { | 1184 | pub struct RangePat { |
1170 | pub(crate) syntax: SyntaxNode, | 1185 | pub(crate) syntax: SyntaxNode, |
1171 | } | 1186 | } |
1172 | impl TypeBound { | 1187 | impl RangePat {} |
1173 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1174 | support::token(&self.syntax, T![lifetime]) | ||
1175 | } | ||
1176 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1177 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1178 | } | ||
1179 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1180 | pub struct WherePred { | 1189 | pub struct RecordPat { |
1181 | pub(crate) syntax: SyntaxNode, | 1190 | pub(crate) syntax: SyntaxNode, |
1182 | } | 1191 | } |
1183 | impl ast::TypeBoundsOwner for WherePred {} | 1192 | impl RecordPat { |
1184 | impl WherePred { | 1193 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1185 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 1194 | pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> { |
1186 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } | 1195 | support::child(&self.syntax) |
1187 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1188 | support::token(&self.syntax, T![lifetime]) | ||
1189 | } | 1196 | } |
1190 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1191 | } | 1197 | } |
1192 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1198 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1193 | pub struct ExprStmt { | 1199 | pub struct RefPat { |
1194 | pub(crate) syntax: SyntaxNode, | 1200 | pub(crate) syntax: SyntaxNode, |
1195 | } | 1201 | } |
1196 | impl ast::AttrsOwner for ExprStmt {} | 1202 | impl RefPat { |
1197 | impl ExprStmt { | 1203 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1198 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1204 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1199 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 1205 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1200 | } | 1206 | } |
1201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1207 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1202 | pub struct LetStmt { | 1208 | pub struct SlicePat { |
1203 | pub(crate) syntax: SyntaxNode, | 1209 | pub(crate) syntax: SyntaxNode, |
1204 | } | 1210 | } |
1205 | impl ast::AttrsOwner for LetStmt {} | 1211 | impl SlicePat { |
1206 | impl LetStmt { | 1212 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1207 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | 1213 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1208 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1214 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1209 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1210 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1211 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1212 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1213 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1214 | } | 1215 | } |
1215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1216 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1216 | pub struct PathSegment { | 1217 | pub struct TuplePat { |
1217 | pub(crate) syntax: SyntaxNode, | 1218 | pub(crate) syntax: SyntaxNode, |
1218 | } | 1219 | } |
1219 | impl PathSegment { | 1220 | impl TuplePat { |
1220 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | 1221 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1221 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 1222 | pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1222 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | 1223 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1223 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
1224 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | ||
1225 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1226 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
1227 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
1228 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
1229 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | ||
1230 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | ||
1231 | } | 1224 | } |
1232 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1225 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1233 | pub struct TypeArg { | 1226 | pub struct TupleStructPat { |
1234 | pub(crate) syntax: SyntaxNode, | 1227 | pub(crate) syntax: SyntaxNode, |
1235 | } | 1228 | } |
1236 | impl TypeArg { | 1229 | impl TupleStructPat { |
1237 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1230 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1231 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1232 | pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | ||
1233 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1238 | } | 1234 | } |
1239 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1235 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1240 | pub struct LifetimeArg { | 1236 | pub struct RecordPatFieldList { |
1241 | pub(crate) syntax: SyntaxNode, | 1237 | pub(crate) syntax: SyntaxNode, |
1242 | } | 1238 | } |
1243 | impl LifetimeArg { | 1239 | impl RecordPatFieldList { |
1244 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 1240 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1245 | support::token(&self.syntax, T![lifetime]) | 1241 | pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) } |
1246 | } | 1242 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1243 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1247 | } | 1244 | } |
1248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1249 | pub struct AssocTypeArg { | 1246 | pub struct RecordPatField { |
1250 | pub(crate) syntax: SyntaxNode, | 1247 | pub(crate) syntax: SyntaxNode, |
1251 | } | 1248 | } |
1252 | impl ast::TypeBoundsOwner for AssocTypeArg {} | 1249 | impl ast::AttrsOwner for RecordPatField {} |
1253 | impl AssocTypeArg { | 1250 | impl RecordPatField { |
1254 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1251 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1255 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 1252 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1256 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1253 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1257 | } | 1254 | } |
1258 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1255 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1259 | pub struct ConstArg { | 1256 | pub enum GenericArg { |
1260 | pub(crate) syntax: SyntaxNode, | 1257 | TypeArg(TypeArg), |
1258 | AssocTypeArg(AssocTypeArg), | ||
1259 | LifetimeArg(LifetimeArg), | ||
1260 | ConstArg(ConstArg), | ||
1261 | } | 1261 | } |
1262 | impl ConstArg { | 1262 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1263 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 1263 | pub enum Type { |
1264 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 1264 | ArrayType(ArrayType), |
1265 | DynTraitType(DynTraitType), | ||
1266 | FnPtrType(FnPtrType), | ||
1267 | ForType(ForType), | ||
1268 | ImplTraitType(ImplTraitType), | ||
1269 | InferType(InferType), | ||
1270 | NeverType(NeverType), | ||
1271 | ParenType(ParenType), | ||
1272 | PathType(PathType), | ||
1273 | PtrType(PtrType), | ||
1274 | RefType(RefType), | ||
1275 | SliceType(SliceType), | ||
1276 | TupleType(TupleType), | ||
1277 | } | ||
1278 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1279 | pub enum Expr { | ||
1280 | ArrayExpr(ArrayExpr), | ||
1281 | AwaitExpr(AwaitExpr), | ||
1282 | BinExpr(BinExpr), | ||
1283 | BlockExpr(BlockExpr), | ||
1284 | BoxExpr(BoxExpr), | ||
1285 | BreakExpr(BreakExpr), | ||
1286 | CallExpr(CallExpr), | ||
1287 | CastExpr(CastExpr), | ||
1288 | ClosureExpr(ClosureExpr), | ||
1289 | ContinueExpr(ContinueExpr), | ||
1290 | EffectExpr(EffectExpr), | ||
1291 | FieldExpr(FieldExpr), | ||
1292 | ForExpr(ForExpr), | ||
1293 | IfExpr(IfExpr), | ||
1294 | IndexExpr(IndexExpr), | ||
1295 | Literal(Literal), | ||
1296 | LoopExpr(LoopExpr), | ||
1297 | MacroCall(MacroCall), | ||
1298 | MatchExpr(MatchExpr), | ||
1299 | MethodCallExpr(MethodCallExpr), | ||
1300 | ParenExpr(ParenExpr), | ||
1301 | PathExpr(PathExpr), | ||
1302 | PrefixExpr(PrefixExpr), | ||
1303 | RangeExpr(RangeExpr), | ||
1304 | RecordExpr(RecordExpr), | ||
1305 | RefExpr(RefExpr), | ||
1306 | ReturnExpr(ReturnExpr), | ||
1307 | TryExpr(TryExpr), | ||
1308 | TupleExpr(TupleExpr), | ||
1309 | WhileExpr(WhileExpr), | ||
1265 | } | 1310 | } |
1266 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1311 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1267 | pub enum Item { | 1312 | pub enum Item { |
@@ -1282,38 +1327,28 @@ pub enum Item { | |||
1282 | } | 1327 | } |
1283 | impl ast::AttrsOwner for Item {} | 1328 | impl ast::AttrsOwner for Item {} |
1284 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1329 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1285 | pub enum TypeRef { | 1330 | pub enum Stmt { |
1286 | ParenType(ParenType), | 1331 | ExprStmt(ExprStmt), |
1287 | TupleType(TupleType), | 1332 | Item(Item), |
1288 | NeverType(NeverType), | 1333 | LetStmt(LetStmt), |
1289 | PathType(PathType), | ||
1290 | PointerType(PointerType), | ||
1291 | ArrayType(ArrayType), | ||
1292 | SliceType(SliceType), | ||
1293 | ReferenceType(ReferenceType), | ||
1294 | PlaceholderType(PlaceholderType), | ||
1295 | FnPointerType(FnPointerType), | ||
1296 | ForType(ForType), | ||
1297 | ImplTraitType(ImplTraitType), | ||
1298 | DynTraitType(DynTraitType), | ||
1299 | } | 1334 | } |
1300 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1335 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1301 | pub enum Pat { | 1336 | pub enum Pat { |
1337 | IdentPat(IdentPat), | ||
1338 | BoxPat(BoxPat), | ||
1339 | RestPat(RestPat), | ||
1340 | LiteralPat(LiteralPat), | ||
1341 | MacroPat(MacroPat), | ||
1302 | OrPat(OrPat), | 1342 | OrPat(OrPat), |
1303 | ParenPat(ParenPat), | 1343 | ParenPat(ParenPat), |
1304 | RefPat(RefPat), | ||
1305 | BoxPat(BoxPat), | ||
1306 | BindPat(BindPat), | ||
1307 | PlaceholderPat(PlaceholderPat), | ||
1308 | DotDotPat(DotDotPat), | ||
1309 | PathPat(PathPat), | 1344 | PathPat(PathPat), |
1345 | WildcardPat(WildcardPat), | ||
1346 | RangePat(RangePat), | ||
1310 | RecordPat(RecordPat), | 1347 | RecordPat(RecordPat), |
1311 | TupleStructPat(TupleStructPat), | 1348 | RefPat(RefPat), |
1312 | TuplePat(TuplePat), | ||
1313 | SlicePat(SlicePat), | 1349 | SlicePat(SlicePat), |
1314 | RangePat(RangePat), | 1350 | TuplePat(TuplePat), |
1315 | LiteralPat(LiteralPat), | 1351 | TupleStructPat(TupleStructPat), |
1316 | MacroPat(MacroPat), | ||
1317 | } | 1352 | } |
1318 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1353 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1319 | pub enum FieldList { | 1354 | pub enum FieldList { |
@@ -1321,81 +1356,52 @@ pub enum FieldList { | |||
1321 | TupleFieldList(TupleFieldList), | 1356 | TupleFieldList(TupleFieldList), |
1322 | } | 1357 | } |
1323 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1358 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1324 | pub enum Expr { | 1359 | pub enum AdtDef { |
1325 | TupleExpr(TupleExpr), | 1360 | Enum(Enum), |
1326 | ArrayExpr(ArrayExpr), | 1361 | Struct(Struct), |
1327 | ParenExpr(ParenExpr), | 1362 | Union(Union), |
1328 | PathExpr(PathExpr), | ||
1329 | LambdaExpr(LambdaExpr), | ||
1330 | IfExpr(IfExpr), | ||
1331 | LoopExpr(LoopExpr), | ||
1332 | ForExpr(ForExpr), | ||
1333 | WhileExpr(WhileExpr), | ||
1334 | ContinueExpr(ContinueExpr), | ||
1335 | BreakExpr(BreakExpr), | ||
1336 | Label(Label), | ||
1337 | BlockExpr(BlockExpr), | ||
1338 | ReturnExpr(ReturnExpr), | ||
1339 | MatchExpr(MatchExpr), | ||
1340 | RecordExpr(RecordExpr), | ||
1341 | CallExpr(CallExpr), | ||
1342 | IndexExpr(IndexExpr), | ||
1343 | MethodCallExpr(MethodCallExpr), | ||
1344 | FieldExpr(FieldExpr), | ||
1345 | AwaitExpr(AwaitExpr), | ||
1346 | TryExpr(TryExpr), | ||
1347 | EffectExpr(EffectExpr), | ||
1348 | CastExpr(CastExpr), | ||
1349 | RefExpr(RefExpr), | ||
1350 | PrefixExpr(PrefixExpr), | ||
1351 | RangeExpr(RangeExpr), | ||
1352 | BinExpr(BinExpr), | ||
1353 | Literal(Literal), | ||
1354 | MacroCall(MacroCall), | ||
1355 | BoxExpr(BoxExpr), | ||
1356 | } | 1363 | } |
1364 | impl ast::AttrsOwner for AdtDef {} | ||
1365 | impl ast::GenericParamsOwner for AdtDef {} | ||
1366 | impl ast::NameOwner for AdtDef {} | ||
1367 | impl ast::VisibilityOwner for AdtDef {} | ||
1357 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1368 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1358 | pub enum AssocItem { | 1369 | pub enum AssocItem { |
1359 | Fn(Fn), | ||
1360 | TypeAlias(TypeAlias), | ||
1361 | Const(Const), | 1370 | Const(Const), |
1371 | Fn(Fn), | ||
1362 | MacroCall(MacroCall), | 1372 | MacroCall(MacroCall), |
1373 | TypeAlias(TypeAlias), | ||
1363 | } | 1374 | } |
1364 | impl ast::AttrsOwner for AssocItem {} | 1375 | impl ast::AttrsOwner for AssocItem {} |
1365 | impl ast::NameOwner for AssocItem {} | 1376 | impl ast::NameOwner for AssocItem {} |
1366 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1367 | pub enum ExternItem { | 1378 | pub enum ExternItem { |
1368 | Fn(Fn), | 1379 | Fn(Fn), |
1369 | Static(Static), | ||
1370 | MacroCall(MacroCall), | 1380 | MacroCall(MacroCall), |
1381 | Static(Static), | ||
1371 | } | 1382 | } |
1372 | impl ast::AttrsOwner for ExternItem {} | 1383 | impl ast::AttrsOwner for ExternItem {} |
1373 | impl ast::NameOwner for ExternItem {} | 1384 | impl ast::NameOwner for ExternItem {} |
1374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1375 | pub enum GenericParam { | 1386 | pub enum GenericParam { |
1387 | ConstParam(ConstParam), | ||
1376 | LifetimeParam(LifetimeParam), | 1388 | LifetimeParam(LifetimeParam), |
1377 | TypeParam(TypeParam), | 1389 | TypeParam(TypeParam), |
1378 | ConstParam(ConstParam), | ||
1379 | } | 1390 | } |
1380 | impl ast::AttrsOwner for GenericParam {} | 1391 | impl ast::AttrsOwner for GenericParam {} |
1381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1392 | impl AstNode for Name { |
1382 | pub enum Stmt { | 1393 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } |
1383 | LetStmt(LetStmt), | 1394 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1384 | ExprStmt(ExprStmt), | 1395 | if Self::can_cast(syntax.kind()) { |
1385 | } | 1396 | Some(Self { syntax }) |
1386 | impl ast::AttrsOwner for Stmt {} | 1397 | } else { |
1387 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1398 | None |
1388 | pub enum AdtDef { | 1399 | } |
1389 | Struct(Struct), | 1400 | } |
1390 | Enum(Enum), | 1401 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1391 | Union(Union), | ||
1392 | } | 1402 | } |
1393 | impl ast::AttrsOwner for AdtDef {} | 1403 | impl AstNode for NameRef { |
1394 | impl ast::GenericParamsOwner for AdtDef {} | 1404 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } |
1395 | impl ast::NameOwner for AdtDef {} | ||
1396 | impl ast::VisibilityOwner for AdtDef {} | ||
1397 | impl AstNode for SourceFile { | ||
1398 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | ||
1399 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1405 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1400 | if Self::can_cast(syntax.kind()) { | 1406 | if Self::can_cast(syntax.kind()) { |
1401 | Some(Self { syntax }) | 1407 | Some(Self { syntax }) |
@@ -1405,8 +1411,8 @@ impl AstNode for SourceFile { | |||
1405 | } | 1411 | } |
1406 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1412 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1407 | } | 1413 | } |
1408 | impl AstNode for Attr { | 1414 | impl AstNode for Path { |
1409 | fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } | 1415 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } |
1410 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1416 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1411 | if Self::can_cast(syntax.kind()) { | 1417 | if Self::can_cast(syntax.kind()) { |
1412 | Some(Self { syntax }) | 1418 | Some(Self { syntax }) |
@@ -1416,8 +1422,8 @@ impl AstNode for Attr { | |||
1416 | } | 1422 | } |
1417 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1423 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1418 | } | 1424 | } |
1419 | impl AstNode for Const { | 1425 | impl AstNode for PathSegment { |
1420 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } | 1426 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
1421 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1427 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1422 | if Self::can_cast(syntax.kind()) { | 1428 | if Self::can_cast(syntax.kind()) { |
1423 | Some(Self { syntax }) | 1429 | Some(Self { syntax }) |
@@ -1427,8 +1433,8 @@ impl AstNode for Const { | |||
1427 | } | 1433 | } |
1428 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1434 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1429 | } | 1435 | } |
1430 | impl AstNode for Enum { | 1436 | impl AstNode for GenericArgList { |
1431 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } | 1437 | fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST } |
1432 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1438 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1433 | if Self::can_cast(syntax.kind()) { | 1439 | if Self::can_cast(syntax.kind()) { |
1434 | Some(Self { syntax }) | 1440 | Some(Self { syntax }) |
@@ -1438,8 +1444,8 @@ impl AstNode for Enum { | |||
1438 | } | 1444 | } |
1439 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1445 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1440 | } | 1446 | } |
1441 | impl AstNode for ExternBlock { | 1447 | impl AstNode for ParamList { |
1442 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } | 1448 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
1443 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1449 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1444 | if Self::can_cast(syntax.kind()) { | 1450 | if Self::can_cast(syntax.kind()) { |
1445 | Some(Self { syntax }) | 1451 | Some(Self { syntax }) |
@@ -1449,8 +1455,8 @@ impl AstNode for ExternBlock { | |||
1449 | } | 1455 | } |
1450 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1456 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1451 | } | 1457 | } |
1452 | impl AstNode for ExternCrate { | 1458 | impl AstNode for RetType { |
1453 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } | 1459 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } |
1454 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1460 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1455 | if Self::can_cast(syntax.kind()) { | 1461 | if Self::can_cast(syntax.kind()) { |
1456 | Some(Self { syntax }) | 1462 | Some(Self { syntax }) |
@@ -1460,8 +1466,8 @@ impl AstNode for ExternCrate { | |||
1460 | } | 1466 | } |
1461 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1467 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1462 | } | 1468 | } |
1463 | impl AstNode for Fn { | 1469 | impl AstNode for PathType { |
1464 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN } | 1470 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } |
1465 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1471 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1466 | if Self::can_cast(syntax.kind()) { | 1472 | if Self::can_cast(syntax.kind()) { |
1467 | Some(Self { syntax }) | 1473 | Some(Self { syntax }) |
@@ -1471,8 +1477,8 @@ impl AstNode for Fn { | |||
1471 | } | 1477 | } |
1472 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1478 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1473 | } | 1479 | } |
1474 | impl AstNode for Impl { | 1480 | impl AstNode for TypeArg { |
1475 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } | 1481 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } |
1476 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1482 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1477 | if Self::can_cast(syntax.kind()) { | 1483 | if Self::can_cast(syntax.kind()) { |
1478 | Some(Self { syntax }) | 1484 | Some(Self { syntax }) |
@@ -1482,8 +1488,8 @@ impl AstNode for Impl { | |||
1482 | } | 1488 | } |
1483 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1489 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1484 | } | 1490 | } |
1485 | impl AstNode for MacroCall { | 1491 | impl AstNode for AssocTypeArg { |
1486 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } | 1492 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } |
1487 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1493 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1488 | if Self::can_cast(syntax.kind()) { | 1494 | if Self::can_cast(syntax.kind()) { |
1489 | Some(Self { syntax }) | 1495 | Some(Self { syntax }) |
@@ -1493,8 +1499,8 @@ impl AstNode for MacroCall { | |||
1493 | } | 1499 | } |
1494 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1500 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1495 | } | 1501 | } |
1496 | impl AstNode for Module { | 1502 | impl AstNode for LifetimeArg { |
1497 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } | 1503 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } |
1498 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1504 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1499 | if Self::can_cast(syntax.kind()) { | 1505 | if Self::can_cast(syntax.kind()) { |
1500 | Some(Self { syntax }) | 1506 | Some(Self { syntax }) |
@@ -1504,8 +1510,8 @@ impl AstNode for Module { | |||
1504 | } | 1510 | } |
1505 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1511 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1506 | } | 1512 | } |
1507 | impl AstNode for Static { | 1513 | impl AstNode for ConstArg { |
1508 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } | 1514 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } |
1509 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1515 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1510 | if Self::can_cast(syntax.kind()) { | 1516 | if Self::can_cast(syntax.kind()) { |
1511 | Some(Self { syntax }) | 1517 | Some(Self { syntax }) |
@@ -1515,8 +1521,8 @@ impl AstNode for Static { | |||
1515 | } | 1521 | } |
1516 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1522 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1517 | } | 1523 | } |
1518 | impl AstNode for Struct { | 1524 | impl AstNode for TypeBoundList { |
1519 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } | 1525 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } |
1520 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1526 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1521 | if Self::can_cast(syntax.kind()) { | 1527 | if Self::can_cast(syntax.kind()) { |
1522 | Some(Self { syntax }) | 1528 | Some(Self { syntax }) |
@@ -1526,8 +1532,8 @@ impl AstNode for Struct { | |||
1526 | } | 1532 | } |
1527 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1533 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1528 | } | 1534 | } |
1529 | impl AstNode for Trait { | 1535 | impl AstNode for MacroCall { |
1530 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } | 1536 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } |
1531 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1537 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1532 | if Self::can_cast(syntax.kind()) { | 1538 | if Self::can_cast(syntax.kind()) { |
1533 | Some(Self { syntax }) | 1539 | Some(Self { syntax }) |
@@ -1537,8 +1543,8 @@ impl AstNode for Trait { | |||
1537 | } | 1543 | } |
1538 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1544 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1539 | } | 1545 | } |
1540 | impl AstNode for TypeAlias { | 1546 | impl AstNode for Attr { |
1541 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } | 1547 | fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } |
1542 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1548 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1543 | if Self::can_cast(syntax.kind()) { | 1549 | if Self::can_cast(syntax.kind()) { |
1544 | Some(Self { syntax }) | 1550 | Some(Self { syntax }) |
@@ -1548,8 +1554,8 @@ impl AstNode for TypeAlias { | |||
1548 | } | 1554 | } |
1549 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1555 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1550 | } | 1556 | } |
1551 | impl AstNode for Union { | 1557 | impl AstNode for TokenTree { |
1552 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } | 1558 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } |
1553 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1559 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1554 | if Self::can_cast(syntax.kind()) { | 1560 | if Self::can_cast(syntax.kind()) { |
1555 | Some(Self { syntax }) | 1561 | Some(Self { syntax }) |
@@ -1559,8 +1565,8 @@ impl AstNode for Union { | |||
1559 | } | 1565 | } |
1560 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1566 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1561 | } | 1567 | } |
1562 | impl AstNode for Use { | 1568 | impl AstNode for MacroItems { |
1563 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE } | 1569 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } |
1564 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1570 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1565 | if Self::can_cast(syntax.kind()) { | 1571 | if Self::can_cast(syntax.kind()) { |
1566 | Some(Self { syntax }) | 1572 | Some(Self { syntax }) |
@@ -1570,8 +1576,8 @@ impl AstNode for Use { | |||
1570 | } | 1576 | } |
1571 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1577 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1572 | } | 1578 | } |
1573 | impl AstNode for Visibility { | 1579 | impl AstNode for MacroStmts { |
1574 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } | 1580 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } |
1575 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1581 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1576 | if Self::can_cast(syntax.kind()) { | 1582 | if Self::can_cast(syntax.kind()) { |
1577 | Some(Self { syntax }) | 1583 | Some(Self { syntax }) |
@@ -1581,8 +1587,8 @@ impl AstNode for Visibility { | |||
1581 | } | 1587 | } |
1582 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1588 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1583 | } | 1589 | } |
1584 | impl AstNode for Name { | 1590 | impl AstNode for SourceFile { |
1585 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } | 1591 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } |
1586 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1592 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1587 | if Self::can_cast(syntax.kind()) { | 1593 | if Self::can_cast(syntax.kind()) { |
1588 | Some(Self { syntax }) | 1594 | Some(Self { syntax }) |
@@ -1592,8 +1598,8 @@ impl AstNode for Name { | |||
1592 | } | 1598 | } |
1593 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1599 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1594 | } | 1600 | } |
1595 | impl AstNode for ItemList { | 1601 | impl AstNode for Const { |
1596 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | 1602 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } |
1597 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1603 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1598 | if Self::can_cast(syntax.kind()) { | 1604 | if Self::can_cast(syntax.kind()) { |
1599 | Some(Self { syntax }) | 1605 | Some(Self { syntax }) |
@@ -1603,8 +1609,8 @@ impl AstNode for ItemList { | |||
1603 | } | 1609 | } |
1604 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1610 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1605 | } | 1611 | } |
1606 | impl AstNode for NameRef { | 1612 | impl AstNode for Enum { |
1607 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } | 1613 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } |
1608 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1614 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1609 | if Self::can_cast(syntax.kind()) { | 1615 | if Self::can_cast(syntax.kind()) { |
1610 | Some(Self { syntax }) | 1616 | Some(Self { syntax }) |
@@ -1614,8 +1620,8 @@ impl AstNode for NameRef { | |||
1614 | } | 1620 | } |
1615 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1621 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1616 | } | 1622 | } |
1617 | impl AstNode for Rename { | 1623 | impl AstNode for ExternBlock { |
1618 | fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } | 1624 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } |
1619 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1625 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1620 | if Self::can_cast(syntax.kind()) { | 1626 | if Self::can_cast(syntax.kind()) { |
1621 | Some(Self { syntax }) | 1627 | Some(Self { syntax }) |
@@ -1625,8 +1631,8 @@ impl AstNode for Rename { | |||
1625 | } | 1631 | } |
1626 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1632 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1627 | } | 1633 | } |
1628 | impl AstNode for UseTree { | 1634 | impl AstNode for ExternCrate { |
1629 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } | 1635 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } |
1630 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1636 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1631 | if Self::can_cast(syntax.kind()) { | 1637 | if Self::can_cast(syntax.kind()) { |
1632 | Some(Self { syntax }) | 1638 | Some(Self { syntax }) |
@@ -1636,8 +1642,8 @@ impl AstNode for UseTree { | |||
1636 | } | 1642 | } |
1637 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1643 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1638 | } | 1644 | } |
1639 | impl AstNode for Path { | 1645 | impl AstNode for Fn { |
1640 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } | 1646 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN } |
1641 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1647 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1642 | if Self::can_cast(syntax.kind()) { | 1648 | if Self::can_cast(syntax.kind()) { |
1643 | Some(Self { syntax }) | 1649 | Some(Self { syntax }) |
@@ -1647,8 +1653,8 @@ impl AstNode for Path { | |||
1647 | } | 1653 | } |
1648 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1654 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1649 | } | 1655 | } |
1650 | impl AstNode for UseTreeList { | 1656 | impl AstNode for Impl { |
1651 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } | 1657 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } |
1652 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1658 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1653 | if Self::can_cast(syntax.kind()) { | 1659 | if Self::can_cast(syntax.kind()) { |
1654 | Some(Self { syntax }) | 1660 | Some(Self { syntax }) |
@@ -1658,8 +1664,8 @@ impl AstNode for UseTreeList { | |||
1658 | } | 1664 | } |
1659 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1665 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1660 | } | 1666 | } |
1661 | impl AstNode for Abi { | 1667 | impl AstNode for Module { |
1662 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 1668 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } |
1663 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1669 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1664 | if Self::can_cast(syntax.kind()) { | 1670 | if Self::can_cast(syntax.kind()) { |
1665 | Some(Self { syntax }) | 1671 | Some(Self { syntax }) |
@@ -1669,8 +1675,8 @@ impl AstNode for Abi { | |||
1669 | } | 1675 | } |
1670 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1676 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1671 | } | 1677 | } |
1672 | impl AstNode for GenericParamList { | 1678 | impl AstNode for Static { |
1673 | fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } | 1679 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } |
1674 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1680 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1675 | if Self::can_cast(syntax.kind()) { | 1681 | if Self::can_cast(syntax.kind()) { |
1676 | Some(Self { syntax }) | 1682 | Some(Self { syntax }) |
@@ -1680,8 +1686,8 @@ impl AstNode for GenericParamList { | |||
1680 | } | 1686 | } |
1681 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1687 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1682 | } | 1688 | } |
1683 | impl AstNode for ParamList { | 1689 | impl AstNode for Struct { |
1684 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 1690 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } |
1685 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1691 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1686 | if Self::can_cast(syntax.kind()) { | 1692 | if Self::can_cast(syntax.kind()) { |
1687 | Some(Self { syntax }) | 1693 | Some(Self { syntax }) |
@@ -1691,8 +1697,8 @@ impl AstNode for ParamList { | |||
1691 | } | 1697 | } |
1692 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1698 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1693 | } | 1699 | } |
1694 | impl AstNode for RetType { | 1700 | impl AstNode for Trait { |
1695 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } | 1701 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } |
1696 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1702 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1697 | if Self::can_cast(syntax.kind()) { | 1703 | if Self::can_cast(syntax.kind()) { |
1698 | Some(Self { syntax }) | 1704 | Some(Self { syntax }) |
@@ -1702,8 +1708,8 @@ impl AstNode for RetType { | |||
1702 | } | 1708 | } |
1703 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1709 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1704 | } | 1710 | } |
1705 | impl AstNode for WhereClause { | 1711 | impl AstNode for TypeAlias { |
1706 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } | 1712 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } |
1707 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1713 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1708 | if Self::can_cast(syntax.kind()) { | 1714 | if Self::can_cast(syntax.kind()) { |
1709 | Some(Self { syntax }) | 1715 | Some(Self { syntax }) |
@@ -1713,8 +1719,8 @@ impl AstNode for WhereClause { | |||
1713 | } | 1719 | } |
1714 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1720 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1715 | } | 1721 | } |
1716 | impl AstNode for BlockExpr { | 1722 | impl AstNode for Union { |
1717 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } | 1723 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } |
1718 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1724 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1719 | if Self::can_cast(syntax.kind()) { | 1725 | if Self::can_cast(syntax.kind()) { |
1720 | Some(Self { syntax }) | 1726 | Some(Self { syntax }) |
@@ -1724,8 +1730,8 @@ impl AstNode for BlockExpr { | |||
1724 | } | 1730 | } |
1725 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1731 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1726 | } | 1732 | } |
1727 | impl AstNode for SelfParam { | 1733 | impl AstNode for Use { |
1728 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } | 1734 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE } |
1729 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1735 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1730 | if Self::can_cast(syntax.kind()) { | 1736 | if Self::can_cast(syntax.kind()) { |
1731 | Some(Self { syntax }) | 1737 | Some(Self { syntax }) |
@@ -1735,8 +1741,8 @@ impl AstNode for SelfParam { | |||
1735 | } | 1741 | } |
1736 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1742 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1737 | } | 1743 | } |
1738 | impl AstNode for Param { | 1744 | impl AstNode for Visibility { |
1739 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } | 1745 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } |
1740 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1746 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1741 | if Self::can_cast(syntax.kind()) { | 1747 | if Self::can_cast(syntax.kind()) { |
1742 | Some(Self { syntax }) | 1748 | Some(Self { syntax }) |
@@ -1746,8 +1752,8 @@ impl AstNode for Param { | |||
1746 | } | 1752 | } |
1747 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1753 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1748 | } | 1754 | } |
1749 | impl AstNode for TypeBoundList { | 1755 | impl AstNode for ItemList { |
1750 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } | 1756 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } |
1751 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1757 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1752 | if Self::can_cast(syntax.kind()) { | 1758 | if Self::can_cast(syntax.kind()) { |
1753 | Some(Self { syntax }) | 1759 | Some(Self { syntax }) |
@@ -1757,8 +1763,8 @@ impl AstNode for TypeBoundList { | |||
1757 | } | 1763 | } |
1758 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1764 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1759 | } | 1765 | } |
1760 | impl AstNode for RecordFieldList { | 1766 | impl AstNode for Rename { |
1761 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } | 1767 | fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } |
1762 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1768 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1763 | if Self::can_cast(syntax.kind()) { | 1769 | if Self::can_cast(syntax.kind()) { |
1764 | Some(Self { syntax }) | 1770 | Some(Self { syntax }) |
@@ -1768,8 +1774,8 @@ impl AstNode for RecordFieldList { | |||
1768 | } | 1774 | } |
1769 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1775 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1770 | } | 1776 | } |
1771 | impl AstNode for TupleFieldList { | 1777 | impl AstNode for UseTree { |
1772 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } | 1778 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } |
1773 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1779 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1774 | if Self::can_cast(syntax.kind()) { | 1780 | if Self::can_cast(syntax.kind()) { |
1775 | Some(Self { syntax }) | 1781 | Some(Self { syntax }) |
@@ -1779,8 +1785,8 @@ impl AstNode for TupleFieldList { | |||
1779 | } | 1785 | } |
1780 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1786 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1781 | } | 1787 | } |
1782 | impl AstNode for RecordField { | 1788 | impl AstNode for UseTreeList { |
1783 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } | 1789 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } |
1784 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1790 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1785 | if Self::can_cast(syntax.kind()) { | 1791 | if Self::can_cast(syntax.kind()) { |
1786 | Some(Self { syntax }) | 1792 | Some(Self { syntax }) |
@@ -1790,8 +1796,8 @@ impl AstNode for RecordField { | |||
1790 | } | 1796 | } |
1791 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1797 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1792 | } | 1798 | } |
1793 | impl AstNode for TupleField { | 1799 | impl AstNode for Abi { |
1794 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } | 1800 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } |
1795 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1801 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1796 | if Self::can_cast(syntax.kind()) { | 1802 | if Self::can_cast(syntax.kind()) { |
1797 | Some(Self { syntax }) | 1803 | Some(Self { syntax }) |
@@ -1801,8 +1807,8 @@ impl AstNode for TupleField { | |||
1801 | } | 1807 | } |
1802 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1808 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1803 | } | 1809 | } |
1804 | impl AstNode for VariantList { | 1810 | impl AstNode for GenericParamList { |
1805 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } | 1811 | fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } |
1806 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1812 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1807 | if Self::can_cast(syntax.kind()) { | 1813 | if Self::can_cast(syntax.kind()) { |
1808 | Some(Self { syntax }) | 1814 | Some(Self { syntax }) |
@@ -1812,8 +1818,8 @@ impl AstNode for VariantList { | |||
1812 | } | 1818 | } |
1813 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1819 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1814 | } | 1820 | } |
1815 | impl AstNode for Variant { | 1821 | impl AstNode for WhereClause { |
1816 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } | 1822 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } |
1817 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1823 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1818 | if Self::can_cast(syntax.kind()) { | 1824 | if Self::can_cast(syntax.kind()) { |
1819 | Some(Self { syntax }) | 1825 | Some(Self { syntax }) |
@@ -1823,8 +1829,8 @@ impl AstNode for Variant { | |||
1823 | } | 1829 | } |
1824 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1830 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1825 | } | 1831 | } |
1826 | impl AstNode for AssocItemList { | 1832 | impl AstNode for BlockExpr { |
1827 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } | 1833 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } |
1828 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1834 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1829 | if Self::can_cast(syntax.kind()) { | 1835 | if Self::can_cast(syntax.kind()) { |
1830 | Some(Self { syntax }) | 1836 | Some(Self { syntax }) |
@@ -1834,8 +1840,8 @@ impl AstNode for AssocItemList { | |||
1834 | } | 1840 | } |
1835 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1841 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1836 | } | 1842 | } |
1837 | impl AstNode for ExternItemList { | 1843 | impl AstNode for SelfParam { |
1838 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | 1844 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } |
1839 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1845 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1840 | if Self::can_cast(syntax.kind()) { | 1846 | if Self::can_cast(syntax.kind()) { |
1841 | Some(Self { syntax }) | 1847 | Some(Self { syntax }) |
@@ -1845,8 +1851,8 @@ impl AstNode for ExternItemList { | |||
1845 | } | 1851 | } |
1846 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1852 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1847 | } | 1853 | } |
1848 | impl AstNode for LifetimeParam { | 1854 | impl AstNode for Param { |
1849 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } | 1855 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } |
1850 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1856 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1851 | if Self::can_cast(syntax.kind()) { | 1857 | if Self::can_cast(syntax.kind()) { |
1852 | Some(Self { syntax }) | 1858 | Some(Self { syntax }) |
@@ -1856,8 +1862,8 @@ impl AstNode for LifetimeParam { | |||
1856 | } | 1862 | } |
1857 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1863 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1858 | } | 1864 | } |
1859 | impl AstNode for TypeParam { | 1865 | impl AstNode for RecordFieldList { |
1860 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } | 1866 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } |
1861 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1867 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1862 | if Self::can_cast(syntax.kind()) { | 1868 | if Self::can_cast(syntax.kind()) { |
1863 | Some(Self { syntax }) | 1869 | Some(Self { syntax }) |
@@ -1867,8 +1873,8 @@ impl AstNode for TypeParam { | |||
1867 | } | 1873 | } |
1868 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1874 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1869 | } | 1875 | } |
1870 | impl AstNode for ConstParam { | 1876 | impl AstNode for TupleFieldList { |
1871 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } | 1877 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } |
1872 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1878 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1873 | if Self::can_cast(syntax.kind()) { | 1879 | if Self::can_cast(syntax.kind()) { |
1874 | Some(Self { syntax }) | 1880 | Some(Self { syntax }) |
@@ -1878,8 +1884,8 @@ impl AstNode for ConstParam { | |||
1878 | } | 1884 | } |
1879 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1885 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1880 | } | 1886 | } |
1881 | impl AstNode for Literal { | 1887 | impl AstNode for RecordField { |
1882 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } | 1888 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } |
1883 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1889 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1884 | if Self::can_cast(syntax.kind()) { | 1890 | if Self::can_cast(syntax.kind()) { |
1885 | Some(Self { syntax }) | 1891 | Some(Self { syntax }) |
@@ -1889,8 +1895,8 @@ impl AstNode for Literal { | |||
1889 | } | 1895 | } |
1890 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1896 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1891 | } | 1897 | } |
1892 | impl AstNode for TokenTree { | 1898 | impl AstNode for TupleField { |
1893 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | 1899 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } |
1894 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1900 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1895 | if Self::can_cast(syntax.kind()) { | 1901 | if Self::can_cast(syntax.kind()) { |
1896 | Some(Self { syntax }) | 1902 | Some(Self { syntax }) |
@@ -1900,8 +1906,8 @@ impl AstNode for TokenTree { | |||
1900 | } | 1906 | } |
1901 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1907 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1902 | } | 1908 | } |
1903 | impl AstNode for ParenType { | 1909 | impl AstNode for VariantList { |
1904 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } | 1910 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } |
1905 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1911 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1906 | if Self::can_cast(syntax.kind()) { | 1912 | if Self::can_cast(syntax.kind()) { |
1907 | Some(Self { syntax }) | 1913 | Some(Self { syntax }) |
@@ -1911,8 +1917,8 @@ impl AstNode for ParenType { | |||
1911 | } | 1917 | } |
1912 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1918 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1913 | } | 1919 | } |
1914 | impl AstNode for TupleType { | 1920 | impl AstNode for Variant { |
1915 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } | 1921 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } |
1916 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1922 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1917 | if Self::can_cast(syntax.kind()) { | 1923 | if Self::can_cast(syntax.kind()) { |
1918 | Some(Self { syntax }) | 1924 | Some(Self { syntax }) |
@@ -1922,8 +1928,8 @@ impl AstNode for TupleType { | |||
1922 | } | 1928 | } |
1923 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1929 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1924 | } | 1930 | } |
1925 | impl AstNode for NeverType { | 1931 | impl AstNode for AssocItemList { |
1926 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } | 1932 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } |
1927 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1933 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1928 | if Self::can_cast(syntax.kind()) { | 1934 | if Self::can_cast(syntax.kind()) { |
1929 | Some(Self { syntax }) | 1935 | Some(Self { syntax }) |
@@ -1933,8 +1939,8 @@ impl AstNode for NeverType { | |||
1933 | } | 1939 | } |
1934 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1940 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1935 | } | 1941 | } |
1936 | impl AstNode for PathType { | 1942 | impl AstNode for ExternItemList { |
1937 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } | 1943 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } |
1938 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1944 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1939 | if Self::can_cast(syntax.kind()) { | 1945 | if Self::can_cast(syntax.kind()) { |
1940 | Some(Self { syntax }) | 1946 | Some(Self { syntax }) |
@@ -1944,8 +1950,8 @@ impl AstNode for PathType { | |||
1944 | } | 1950 | } |
1945 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1951 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1946 | } | 1952 | } |
1947 | impl AstNode for PointerType { | 1953 | impl AstNode for ConstParam { |
1948 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } | 1954 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } |
1949 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1955 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1950 | if Self::can_cast(syntax.kind()) { | 1956 | if Self::can_cast(syntax.kind()) { |
1951 | Some(Self { syntax }) | 1957 | Some(Self { syntax }) |
@@ -1955,8 +1961,8 @@ impl AstNode for PointerType { | |||
1955 | } | 1961 | } |
1956 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1962 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1957 | } | 1963 | } |
1958 | impl AstNode for ArrayType { | 1964 | impl AstNode for LifetimeParam { |
1959 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } | 1965 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } |
1960 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1966 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1961 | if Self::can_cast(syntax.kind()) { | 1967 | if Self::can_cast(syntax.kind()) { |
1962 | Some(Self { syntax }) | 1968 | Some(Self { syntax }) |
@@ -1966,8 +1972,8 @@ impl AstNode for ArrayType { | |||
1966 | } | 1972 | } |
1967 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1973 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1968 | } | 1974 | } |
1969 | impl AstNode for SliceType { | 1975 | impl AstNode for TypeParam { |
1970 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } | 1976 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } |
1971 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1977 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1972 | if Self::can_cast(syntax.kind()) { | 1978 | if Self::can_cast(syntax.kind()) { |
1973 | Some(Self { syntax }) | 1979 | Some(Self { syntax }) |
@@ -1977,8 +1983,8 @@ impl AstNode for SliceType { | |||
1977 | } | 1983 | } |
1978 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1984 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1979 | } | 1985 | } |
1980 | impl AstNode for ReferenceType { | 1986 | impl AstNode for WherePred { |
1981 | fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } | 1987 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } |
1982 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1988 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1983 | if Self::can_cast(syntax.kind()) { | 1989 | if Self::can_cast(syntax.kind()) { |
1984 | Some(Self { syntax }) | 1990 | Some(Self { syntax }) |
@@ -1988,8 +1994,8 @@ impl AstNode for ReferenceType { | |||
1988 | } | 1994 | } |
1989 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1995 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1990 | } | 1996 | } |
1991 | impl AstNode for PlaceholderType { | 1997 | impl AstNode for Literal { |
1992 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } | 1998 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } |
1993 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1999 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1994 | if Self::can_cast(syntax.kind()) { | 2000 | if Self::can_cast(syntax.kind()) { |
1995 | Some(Self { syntax }) | 2001 | Some(Self { syntax }) |
@@ -1999,8 +2005,8 @@ impl AstNode for PlaceholderType { | |||
1999 | } | 2005 | } |
2000 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2006 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2001 | } | 2007 | } |
2002 | impl AstNode for FnPointerType { | 2008 | impl AstNode for ExprStmt { |
2003 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } | 2009 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } |
2004 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2010 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2005 | if Self::can_cast(syntax.kind()) { | 2011 | if Self::can_cast(syntax.kind()) { |
2006 | Some(Self { syntax }) | 2012 | Some(Self { syntax }) |
@@ -2010,8 +2016,8 @@ impl AstNode for FnPointerType { | |||
2010 | } | 2016 | } |
2011 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2017 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2012 | } | 2018 | } |
2013 | impl AstNode for ForType { | 2019 | impl AstNode for LetStmt { |
2014 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } | 2020 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } |
2015 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2021 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2016 | if Self::can_cast(syntax.kind()) { | 2022 | if Self::can_cast(syntax.kind()) { |
2017 | Some(Self { syntax }) | 2023 | Some(Self { syntax }) |
@@ -2021,8 +2027,8 @@ impl AstNode for ForType { | |||
2021 | } | 2027 | } |
2022 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2028 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2023 | } | 2029 | } |
2024 | impl AstNode for ImplTraitType { | 2030 | impl AstNode for ArrayExpr { |
2025 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } | 2031 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } |
2026 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2032 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2027 | if Self::can_cast(syntax.kind()) { | 2033 | if Self::can_cast(syntax.kind()) { |
2028 | Some(Self { syntax }) | 2034 | Some(Self { syntax }) |
@@ -2032,8 +2038,8 @@ impl AstNode for ImplTraitType { | |||
2032 | } | 2038 | } |
2033 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2039 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2034 | } | 2040 | } |
2035 | impl AstNode for DynTraitType { | 2041 | impl AstNode for AwaitExpr { |
2036 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } | 2042 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } |
2037 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2043 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2038 | if Self::can_cast(syntax.kind()) { | 2044 | if Self::can_cast(syntax.kind()) { |
2039 | Some(Self { syntax }) | 2045 | Some(Self { syntax }) |
@@ -2043,8 +2049,8 @@ impl AstNode for DynTraitType { | |||
2043 | } | 2049 | } |
2044 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2050 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2045 | } | 2051 | } |
2046 | impl AstNode for TupleExpr { | 2052 | impl AstNode for BinExpr { |
2047 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } | 2053 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } |
2048 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2054 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2049 | if Self::can_cast(syntax.kind()) { | 2055 | if Self::can_cast(syntax.kind()) { |
2050 | Some(Self { syntax }) | 2056 | Some(Self { syntax }) |
@@ -2054,8 +2060,8 @@ impl AstNode for TupleExpr { | |||
2054 | } | 2060 | } |
2055 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2061 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2056 | } | 2062 | } |
2057 | impl AstNode for ArrayExpr { | 2063 | impl AstNode for BoxExpr { |
2058 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } | 2064 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } |
2059 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2065 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2060 | if Self::can_cast(syntax.kind()) { | 2066 | if Self::can_cast(syntax.kind()) { |
2061 | Some(Self { syntax }) | 2067 | Some(Self { syntax }) |
@@ -2065,8 +2071,8 @@ impl AstNode for ArrayExpr { | |||
2065 | } | 2071 | } |
2066 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2072 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2067 | } | 2073 | } |
2068 | impl AstNode for ParenExpr { | 2074 | impl AstNode for BreakExpr { |
2069 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } | 2075 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } |
2070 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2076 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2071 | if Self::can_cast(syntax.kind()) { | 2077 | if Self::can_cast(syntax.kind()) { |
2072 | Some(Self { syntax }) | 2078 | Some(Self { syntax }) |
@@ -2076,8 +2082,8 @@ impl AstNode for ParenExpr { | |||
2076 | } | 2082 | } |
2077 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2083 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2078 | } | 2084 | } |
2079 | impl AstNode for PathExpr { | 2085 | impl AstNode for CallExpr { |
2080 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } | 2086 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } |
2081 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2087 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2082 | if Self::can_cast(syntax.kind()) { | 2088 | if Self::can_cast(syntax.kind()) { |
2083 | Some(Self { syntax }) | 2089 | Some(Self { syntax }) |
@@ -2087,8 +2093,8 @@ impl AstNode for PathExpr { | |||
2087 | } | 2093 | } |
2088 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2094 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2089 | } | 2095 | } |
2090 | impl AstNode for LambdaExpr { | 2096 | impl AstNode for CastExpr { |
2091 | fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } | 2097 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } |
2092 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2098 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2093 | if Self::can_cast(syntax.kind()) { | 2099 | if Self::can_cast(syntax.kind()) { |
2094 | Some(Self { syntax }) | 2100 | Some(Self { syntax }) |
@@ -2098,8 +2104,8 @@ impl AstNode for LambdaExpr { | |||
2098 | } | 2104 | } |
2099 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2105 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2100 | } | 2106 | } |
2101 | impl AstNode for IfExpr { | 2107 | impl AstNode for ClosureExpr { |
2102 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } | 2108 | fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } |
2103 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2109 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2104 | if Self::can_cast(syntax.kind()) { | 2110 | if Self::can_cast(syntax.kind()) { |
2105 | Some(Self { syntax }) | 2111 | Some(Self { syntax }) |
@@ -2109,8 +2115,8 @@ impl AstNode for IfExpr { | |||
2109 | } | 2115 | } |
2110 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2116 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2111 | } | 2117 | } |
2112 | impl AstNode for Condition { | 2118 | impl AstNode for ContinueExpr { |
2113 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } | 2119 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } |
2114 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2120 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2115 | if Self::can_cast(syntax.kind()) { | 2121 | if Self::can_cast(syntax.kind()) { |
2116 | Some(Self { syntax }) | 2122 | Some(Self { syntax }) |
@@ -2131,8 +2137,8 @@ impl AstNode for EffectExpr { | |||
2131 | } | 2137 | } |
2132 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2138 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2133 | } | 2139 | } |
2134 | impl AstNode for Label { | 2140 | impl AstNode for FieldExpr { |
2135 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } | 2141 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } |
2136 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2142 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2137 | if Self::can_cast(syntax.kind()) { | 2143 | if Self::can_cast(syntax.kind()) { |
2138 | Some(Self { syntax }) | 2144 | Some(Self { syntax }) |
@@ -2142,8 +2148,8 @@ impl AstNode for Label { | |||
2142 | } | 2148 | } |
2143 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2149 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2144 | } | 2150 | } |
2145 | impl AstNode for LoopExpr { | 2151 | impl AstNode for ForExpr { |
2146 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } | 2152 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } |
2147 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2153 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2148 | if Self::can_cast(syntax.kind()) { | 2154 | if Self::can_cast(syntax.kind()) { |
2149 | Some(Self { syntax }) | 2155 | Some(Self { syntax }) |
@@ -2153,8 +2159,8 @@ impl AstNode for LoopExpr { | |||
2153 | } | 2159 | } |
2154 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2160 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2155 | } | 2161 | } |
2156 | impl AstNode for ForExpr { | 2162 | impl AstNode for IfExpr { |
2157 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } | 2163 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } |
2158 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2164 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2159 | if Self::can_cast(syntax.kind()) { | 2165 | if Self::can_cast(syntax.kind()) { |
2160 | Some(Self { syntax }) | 2166 | Some(Self { syntax }) |
@@ -2164,8 +2170,8 @@ impl AstNode for ForExpr { | |||
2164 | } | 2170 | } |
2165 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2171 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2166 | } | 2172 | } |
2167 | impl AstNode for WhileExpr { | 2173 | impl AstNode for IndexExpr { |
2168 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } | 2174 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } |
2169 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2175 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2170 | if Self::can_cast(syntax.kind()) { | 2176 | if Self::can_cast(syntax.kind()) { |
2171 | Some(Self { syntax }) | 2177 | Some(Self { syntax }) |
@@ -2175,8 +2181,8 @@ impl AstNode for WhileExpr { | |||
2175 | } | 2181 | } |
2176 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2182 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2177 | } | 2183 | } |
2178 | impl AstNode for ContinueExpr { | 2184 | impl AstNode for LoopExpr { |
2179 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } | 2185 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } |
2180 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2186 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2181 | if Self::can_cast(syntax.kind()) { | 2187 | if Self::can_cast(syntax.kind()) { |
2182 | Some(Self { syntax }) | 2188 | Some(Self { syntax }) |
@@ -2186,8 +2192,8 @@ impl AstNode for ContinueExpr { | |||
2186 | } | 2192 | } |
2187 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2193 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2188 | } | 2194 | } |
2189 | impl AstNode for BreakExpr { | 2195 | impl AstNode for MatchExpr { |
2190 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } | 2196 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } |
2191 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2197 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2192 | if Self::can_cast(syntax.kind()) { | 2198 | if Self::can_cast(syntax.kind()) { |
2193 | Some(Self { syntax }) | 2199 | Some(Self { syntax }) |
@@ -2197,8 +2203,8 @@ impl AstNode for BreakExpr { | |||
2197 | } | 2203 | } |
2198 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2204 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2199 | } | 2205 | } |
2200 | impl AstNode for ReturnExpr { | 2206 | impl AstNode for MethodCallExpr { |
2201 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } | 2207 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } |
2202 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2208 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2203 | if Self::can_cast(syntax.kind()) { | 2209 | if Self::can_cast(syntax.kind()) { |
2204 | Some(Self { syntax }) | 2210 | Some(Self { syntax }) |
@@ -2208,8 +2214,8 @@ impl AstNode for ReturnExpr { | |||
2208 | } | 2214 | } |
2209 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2215 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2210 | } | 2216 | } |
2211 | impl AstNode for CallExpr { | 2217 | impl AstNode for ParenExpr { |
2212 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } | 2218 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } |
2213 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2219 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2214 | if Self::can_cast(syntax.kind()) { | 2220 | if Self::can_cast(syntax.kind()) { |
2215 | Some(Self { syntax }) | 2221 | Some(Self { syntax }) |
@@ -2219,8 +2225,8 @@ impl AstNode for CallExpr { | |||
2219 | } | 2225 | } |
2220 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2226 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2221 | } | 2227 | } |
2222 | impl AstNode for ArgList { | 2228 | impl AstNode for PathExpr { |
2223 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } | 2229 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } |
2224 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2230 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2225 | if Self::can_cast(syntax.kind()) { | 2231 | if Self::can_cast(syntax.kind()) { |
2226 | Some(Self { syntax }) | 2232 | Some(Self { syntax }) |
@@ -2230,8 +2236,8 @@ impl AstNode for ArgList { | |||
2230 | } | 2236 | } |
2231 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2237 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2232 | } | 2238 | } |
2233 | impl AstNode for MethodCallExpr { | 2239 | impl AstNode for PrefixExpr { |
2234 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } | 2240 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } |
2235 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2241 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2236 | if Self::can_cast(syntax.kind()) { | 2242 | if Self::can_cast(syntax.kind()) { |
2237 | Some(Self { syntax }) | 2243 | Some(Self { syntax }) |
@@ -2241,8 +2247,8 @@ impl AstNode for MethodCallExpr { | |||
2241 | } | 2247 | } |
2242 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2248 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2243 | } | 2249 | } |
2244 | impl AstNode for TypeArgList { | 2250 | impl AstNode for RangeExpr { |
2245 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } | 2251 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } |
2246 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2252 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2247 | if Self::can_cast(syntax.kind()) { | 2253 | if Self::can_cast(syntax.kind()) { |
2248 | Some(Self { syntax }) | 2254 | Some(Self { syntax }) |
@@ -2252,8 +2258,8 @@ impl AstNode for TypeArgList { | |||
2252 | } | 2258 | } |
2253 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2259 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2254 | } | 2260 | } |
2255 | impl AstNode for FieldExpr { | 2261 | impl AstNode for RecordExpr { |
2256 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } | 2262 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } |
2257 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2263 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2258 | if Self::can_cast(syntax.kind()) { | 2264 | if Self::can_cast(syntax.kind()) { |
2259 | Some(Self { syntax }) | 2265 | Some(Self { syntax }) |
@@ -2263,8 +2269,8 @@ impl AstNode for FieldExpr { | |||
2263 | } | 2269 | } |
2264 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2270 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2265 | } | 2271 | } |
2266 | impl AstNode for IndexExpr { | 2272 | impl AstNode for RefExpr { |
2267 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } | 2273 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } |
2268 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2274 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2269 | if Self::can_cast(syntax.kind()) { | 2275 | if Self::can_cast(syntax.kind()) { |
2270 | Some(Self { syntax }) | 2276 | Some(Self { syntax }) |
@@ -2274,8 +2280,8 @@ impl AstNode for IndexExpr { | |||
2274 | } | 2280 | } |
2275 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2281 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2276 | } | 2282 | } |
2277 | impl AstNode for AwaitExpr { | 2283 | impl AstNode for ReturnExpr { |
2278 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } | 2284 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } |
2279 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2285 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2280 | if Self::can_cast(syntax.kind()) { | 2286 | if Self::can_cast(syntax.kind()) { |
2281 | Some(Self { syntax }) | 2287 | Some(Self { syntax }) |
@@ -2296,8 +2302,8 @@ impl AstNode for TryExpr { | |||
2296 | } | 2302 | } |
2297 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2303 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2298 | } | 2304 | } |
2299 | impl AstNode for CastExpr { | 2305 | impl AstNode for TupleExpr { |
2300 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } | 2306 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } |
2301 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2307 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2302 | if Self::can_cast(syntax.kind()) { | 2308 | if Self::can_cast(syntax.kind()) { |
2303 | Some(Self { syntax }) | 2309 | Some(Self { syntax }) |
@@ -2307,8 +2313,8 @@ impl AstNode for CastExpr { | |||
2307 | } | 2313 | } |
2308 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2314 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2309 | } | 2315 | } |
2310 | impl AstNode for RefExpr { | 2316 | impl AstNode for WhileExpr { |
2311 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } | 2317 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } |
2312 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2318 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2313 | if Self::can_cast(syntax.kind()) { | 2319 | if Self::can_cast(syntax.kind()) { |
2314 | Some(Self { syntax }) | 2320 | Some(Self { syntax }) |
@@ -2318,8 +2324,8 @@ impl AstNode for RefExpr { | |||
2318 | } | 2324 | } |
2319 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2325 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2320 | } | 2326 | } |
2321 | impl AstNode for PrefixExpr { | 2327 | impl AstNode for Label { |
2322 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } | 2328 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } |
2323 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2329 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2324 | if Self::can_cast(syntax.kind()) { | 2330 | if Self::can_cast(syntax.kind()) { |
2325 | Some(Self { syntax }) | 2331 | Some(Self { syntax }) |
@@ -2329,8 +2335,8 @@ impl AstNode for PrefixExpr { | |||
2329 | } | 2335 | } |
2330 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2336 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2331 | } | 2337 | } |
2332 | impl AstNode for BoxExpr { | 2338 | impl AstNode for RecordExprFieldList { |
2333 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } | 2339 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } |
2334 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2340 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2335 | if Self::can_cast(syntax.kind()) { | 2341 | if Self::can_cast(syntax.kind()) { |
2336 | Some(Self { syntax }) | 2342 | Some(Self { syntax }) |
@@ -2340,8 +2346,8 @@ impl AstNode for BoxExpr { | |||
2340 | } | 2346 | } |
2341 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2347 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2342 | } | 2348 | } |
2343 | impl AstNode for RangeExpr { | 2349 | impl AstNode for RecordExprField { |
2344 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } | 2350 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } |
2345 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2351 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2346 | if Self::can_cast(syntax.kind()) { | 2352 | if Self::can_cast(syntax.kind()) { |
2347 | Some(Self { syntax }) | 2353 | Some(Self { syntax }) |
@@ -2351,8 +2357,8 @@ impl AstNode for RangeExpr { | |||
2351 | } | 2357 | } |
2352 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2358 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2353 | } | 2359 | } |
2354 | impl AstNode for BinExpr { | 2360 | impl AstNode for ArgList { |
2355 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } | 2361 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } |
2356 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2362 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2357 | if Self::can_cast(syntax.kind()) { | 2363 | if Self::can_cast(syntax.kind()) { |
2358 | Some(Self { syntax }) | 2364 | Some(Self { syntax }) |
@@ -2362,8 +2368,8 @@ impl AstNode for BinExpr { | |||
2362 | } | 2368 | } |
2363 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2369 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2364 | } | 2370 | } |
2365 | impl AstNode for MatchExpr { | 2371 | impl AstNode for Condition { |
2366 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } | 2372 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } |
2367 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2373 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2368 | if Self::can_cast(syntax.kind()) { | 2374 | if Self::can_cast(syntax.kind()) { |
2369 | Some(Self { syntax }) | 2375 | Some(Self { syntax }) |
@@ -2406,8 +2412,8 @@ impl AstNode for MatchGuard { | |||
2406 | } | 2412 | } |
2407 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2413 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2408 | } | 2414 | } |
2409 | impl AstNode for RecordExpr { | 2415 | impl AstNode for ArrayType { |
2410 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } | 2416 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } |
2411 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2417 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2412 | if Self::can_cast(syntax.kind()) { | 2418 | if Self::can_cast(syntax.kind()) { |
2413 | Some(Self { syntax }) | 2419 | Some(Self { syntax }) |
@@ -2417,8 +2423,8 @@ impl AstNode for RecordExpr { | |||
2417 | } | 2423 | } |
2418 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2424 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2419 | } | 2425 | } |
2420 | impl AstNode for RecordExprFieldList { | 2426 | impl AstNode for DynTraitType { |
2421 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } | 2427 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } |
2422 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2428 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2423 | if Self::can_cast(syntax.kind()) { | 2429 | if Self::can_cast(syntax.kind()) { |
2424 | Some(Self { syntax }) | 2430 | Some(Self { syntax }) |
@@ -2428,8 +2434,8 @@ impl AstNode for RecordExprFieldList { | |||
2428 | } | 2434 | } |
2429 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2435 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2430 | } | 2436 | } |
2431 | impl AstNode for RecordExprField { | 2437 | impl AstNode for FnPtrType { |
2432 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } | 2438 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_PTR_TYPE } |
2433 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2439 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2434 | if Self::can_cast(syntax.kind()) { | 2440 | if Self::can_cast(syntax.kind()) { |
2435 | Some(Self { syntax }) | 2441 | Some(Self { syntax }) |
@@ -2439,8 +2445,8 @@ impl AstNode for RecordExprField { | |||
2439 | } | 2445 | } |
2440 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2446 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2441 | } | 2447 | } |
2442 | impl AstNode for OrPat { | 2448 | impl AstNode for ForType { |
2443 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } | 2449 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } |
2444 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2450 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2445 | if Self::can_cast(syntax.kind()) { | 2451 | if Self::can_cast(syntax.kind()) { |
2446 | Some(Self { syntax }) | 2452 | Some(Self { syntax }) |
@@ -2450,8 +2456,8 @@ impl AstNode for OrPat { | |||
2450 | } | 2456 | } |
2451 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2457 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2452 | } | 2458 | } |
2453 | impl AstNode for ParenPat { | 2459 | impl AstNode for ImplTraitType { |
2454 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } | 2460 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } |
2455 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2461 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2456 | if Self::can_cast(syntax.kind()) { | 2462 | if Self::can_cast(syntax.kind()) { |
2457 | Some(Self { syntax }) | 2463 | Some(Self { syntax }) |
@@ -2461,8 +2467,8 @@ impl AstNode for ParenPat { | |||
2461 | } | 2467 | } |
2462 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2468 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2463 | } | 2469 | } |
2464 | impl AstNode for RefPat { | 2470 | impl AstNode for InferType { |
2465 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } | 2471 | fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } |
2466 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2472 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2467 | if Self::can_cast(syntax.kind()) { | 2473 | if Self::can_cast(syntax.kind()) { |
2468 | Some(Self { syntax }) | 2474 | Some(Self { syntax }) |
@@ -2472,8 +2478,8 @@ impl AstNode for RefPat { | |||
2472 | } | 2478 | } |
2473 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2479 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2474 | } | 2480 | } |
2475 | impl AstNode for BoxPat { | 2481 | impl AstNode for NeverType { |
2476 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } | 2482 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } |
2477 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2483 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2478 | if Self::can_cast(syntax.kind()) { | 2484 | if Self::can_cast(syntax.kind()) { |
2479 | Some(Self { syntax }) | 2485 | Some(Self { syntax }) |
@@ -2483,8 +2489,8 @@ impl AstNode for BoxPat { | |||
2483 | } | 2489 | } |
2484 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2490 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2485 | } | 2491 | } |
2486 | impl AstNode for BindPat { | 2492 | impl AstNode for ParenType { |
2487 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } | 2493 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } |
2488 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2494 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2489 | if Self::can_cast(syntax.kind()) { | 2495 | if Self::can_cast(syntax.kind()) { |
2490 | Some(Self { syntax }) | 2496 | Some(Self { syntax }) |
@@ -2494,8 +2500,8 @@ impl AstNode for BindPat { | |||
2494 | } | 2500 | } |
2495 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2501 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2496 | } | 2502 | } |
2497 | impl AstNode for PlaceholderPat { | 2503 | impl AstNode for PtrType { |
2498 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } | 2504 | fn can_cast(kind: SyntaxKind) -> bool { kind == PTR_TYPE } |
2499 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2505 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2500 | if Self::can_cast(syntax.kind()) { | 2506 | if Self::can_cast(syntax.kind()) { |
2501 | Some(Self { syntax }) | 2507 | Some(Self { syntax }) |
@@ -2505,8 +2511,8 @@ impl AstNode for PlaceholderPat { | |||
2505 | } | 2511 | } |
2506 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2512 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2507 | } | 2513 | } |
2508 | impl AstNode for DotDotPat { | 2514 | impl AstNode for RefType { |
2509 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } | 2515 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_TYPE } |
2510 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2516 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2511 | if Self::can_cast(syntax.kind()) { | 2517 | if Self::can_cast(syntax.kind()) { |
2512 | Some(Self { syntax }) | 2518 | Some(Self { syntax }) |
@@ -2516,8 +2522,8 @@ impl AstNode for DotDotPat { | |||
2516 | } | 2522 | } |
2517 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2523 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2518 | } | 2524 | } |
2519 | impl AstNode for PathPat { | 2525 | impl AstNode for SliceType { |
2520 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } | 2526 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } |
2521 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2527 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2522 | if Self::can_cast(syntax.kind()) { | 2528 | if Self::can_cast(syntax.kind()) { |
2523 | Some(Self { syntax }) | 2529 | Some(Self { syntax }) |
@@ -2527,8 +2533,8 @@ impl AstNode for PathPat { | |||
2527 | } | 2533 | } |
2528 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2534 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2529 | } | 2535 | } |
2530 | impl AstNode for SlicePat { | 2536 | impl AstNode for TupleType { |
2531 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } | 2537 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } |
2532 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2538 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2533 | if Self::can_cast(syntax.kind()) { | 2539 | if Self::can_cast(syntax.kind()) { |
2534 | Some(Self { syntax }) | 2540 | Some(Self { syntax }) |
@@ -2538,8 +2544,8 @@ impl AstNode for SlicePat { | |||
2538 | } | 2544 | } |
2539 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2545 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2540 | } | 2546 | } |
2541 | impl AstNode for RangePat { | 2547 | impl AstNode for TypeBound { |
2542 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } | 2548 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } |
2543 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2549 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2544 | if Self::can_cast(syntax.kind()) { | 2550 | if Self::can_cast(syntax.kind()) { |
2545 | Some(Self { syntax }) | 2551 | Some(Self { syntax }) |
@@ -2549,8 +2555,8 @@ impl AstNode for RangePat { | |||
2549 | } | 2555 | } |
2550 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2556 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2551 | } | 2557 | } |
2552 | impl AstNode for LiteralPat { | 2558 | impl AstNode for IdentPat { |
2553 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } | 2559 | fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT_PAT } |
2554 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2560 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2555 | if Self::can_cast(syntax.kind()) { | 2561 | if Self::can_cast(syntax.kind()) { |
2556 | Some(Self { syntax }) | 2562 | Some(Self { syntax }) |
@@ -2560,8 +2566,8 @@ impl AstNode for LiteralPat { | |||
2560 | } | 2566 | } |
2561 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2567 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2562 | } | 2568 | } |
2563 | impl AstNode for MacroPat { | 2569 | impl AstNode for BoxPat { |
2564 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } | 2570 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } |
2565 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2571 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2566 | if Self::can_cast(syntax.kind()) { | 2572 | if Self::can_cast(syntax.kind()) { |
2567 | Some(Self { syntax }) | 2573 | Some(Self { syntax }) |
@@ -2571,8 +2577,8 @@ impl AstNode for MacroPat { | |||
2571 | } | 2577 | } |
2572 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2578 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2573 | } | 2579 | } |
2574 | impl AstNode for RecordPat { | 2580 | impl AstNode for RestPat { |
2575 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } | 2581 | fn can_cast(kind: SyntaxKind) -> bool { kind == REST_PAT } |
2576 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2582 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2577 | if Self::can_cast(syntax.kind()) { | 2583 | if Self::can_cast(syntax.kind()) { |
2578 | Some(Self { syntax }) | 2584 | Some(Self { syntax }) |
@@ -2582,8 +2588,8 @@ impl AstNode for RecordPat { | |||
2582 | } | 2588 | } |
2583 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2589 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2584 | } | 2590 | } |
2585 | impl AstNode for RecordFieldPatList { | 2591 | impl AstNode for LiteralPat { |
2586 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } | 2592 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } |
2587 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2593 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2588 | if Self::can_cast(syntax.kind()) { | 2594 | if Self::can_cast(syntax.kind()) { |
2589 | Some(Self { syntax }) | 2595 | Some(Self { syntax }) |
@@ -2593,8 +2599,8 @@ impl AstNode for RecordFieldPatList { | |||
2593 | } | 2599 | } |
2594 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2600 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2595 | } | 2601 | } |
2596 | impl AstNode for RecordFieldPat { | 2602 | impl AstNode for MacroPat { |
2597 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } | 2603 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } |
2598 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2604 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2599 | if Self::can_cast(syntax.kind()) { | 2605 | if Self::can_cast(syntax.kind()) { |
2600 | Some(Self { syntax }) | 2606 | Some(Self { syntax }) |
@@ -2604,8 +2610,8 @@ impl AstNode for RecordFieldPat { | |||
2604 | } | 2610 | } |
2605 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2611 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2606 | } | 2612 | } |
2607 | impl AstNode for TupleStructPat { | 2613 | impl AstNode for OrPat { |
2608 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } | 2614 | fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } |
2609 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2615 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2610 | if Self::can_cast(syntax.kind()) { | 2616 | if Self::can_cast(syntax.kind()) { |
2611 | Some(Self { syntax }) | 2617 | Some(Self { syntax }) |
@@ -2615,8 +2621,8 @@ impl AstNode for TupleStructPat { | |||
2615 | } | 2621 | } |
2616 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2622 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2617 | } | 2623 | } |
2618 | impl AstNode for TuplePat { | 2624 | impl AstNode for ParenPat { |
2619 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } | 2625 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } |
2620 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2626 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2621 | if Self::can_cast(syntax.kind()) { | 2627 | if Self::can_cast(syntax.kind()) { |
2622 | Some(Self { syntax }) | 2628 | Some(Self { syntax }) |
@@ -2626,8 +2632,8 @@ impl AstNode for TuplePat { | |||
2626 | } | 2632 | } |
2627 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2633 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2628 | } | 2634 | } |
2629 | impl AstNode for MacroDef { | 2635 | impl AstNode for PathPat { |
2630 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } | 2636 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } |
2631 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2637 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2632 | if Self::can_cast(syntax.kind()) { | 2638 | if Self::can_cast(syntax.kind()) { |
2633 | Some(Self { syntax }) | 2639 | Some(Self { syntax }) |
@@ -2637,8 +2643,8 @@ impl AstNode for MacroDef { | |||
2637 | } | 2643 | } |
2638 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2644 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2639 | } | 2645 | } |
2640 | impl AstNode for MacroItems { | 2646 | impl AstNode for WildcardPat { |
2641 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } | 2647 | fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT } |
2642 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2648 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2643 | if Self::can_cast(syntax.kind()) { | 2649 | if Self::can_cast(syntax.kind()) { |
2644 | Some(Self { syntax }) | 2650 | Some(Self { syntax }) |
@@ -2648,8 +2654,8 @@ impl AstNode for MacroItems { | |||
2648 | } | 2654 | } |
2649 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2655 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2650 | } | 2656 | } |
2651 | impl AstNode for MacroStmts { | 2657 | impl AstNode for RangePat { |
2652 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } | 2658 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } |
2653 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2659 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2654 | if Self::can_cast(syntax.kind()) { | 2660 | if Self::can_cast(syntax.kind()) { |
2655 | Some(Self { syntax }) | 2661 | Some(Self { syntax }) |
@@ -2659,8 +2665,8 @@ impl AstNode for MacroStmts { | |||
2659 | } | 2665 | } |
2660 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2666 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2661 | } | 2667 | } |
2662 | impl AstNode for TypeBound { | 2668 | impl AstNode for RecordPat { |
2663 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } | 2669 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } |
2664 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2670 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2665 | if Self::can_cast(syntax.kind()) { | 2671 | if Self::can_cast(syntax.kind()) { |
2666 | Some(Self { syntax }) | 2672 | Some(Self { syntax }) |
@@ -2670,8 +2676,8 @@ impl AstNode for TypeBound { | |||
2670 | } | 2676 | } |
2671 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2677 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2672 | } | 2678 | } |
2673 | impl AstNode for WherePred { | 2679 | impl AstNode for RefPat { |
2674 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } | 2680 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } |
2675 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2681 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2676 | if Self::can_cast(syntax.kind()) { | 2682 | if Self::can_cast(syntax.kind()) { |
2677 | Some(Self { syntax }) | 2683 | Some(Self { syntax }) |
@@ -2681,8 +2687,8 @@ impl AstNode for WherePred { | |||
2681 | } | 2687 | } |
2682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2688 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2683 | } | 2689 | } |
2684 | impl AstNode for ExprStmt { | 2690 | impl AstNode for SlicePat { |
2685 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } | 2691 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } |
2686 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2692 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2687 | if Self::can_cast(syntax.kind()) { | 2693 | if Self::can_cast(syntax.kind()) { |
2688 | Some(Self { syntax }) | 2694 | Some(Self { syntax }) |
@@ -2692,8 +2698,8 @@ impl AstNode for ExprStmt { | |||
2692 | } | 2698 | } |
2693 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2699 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2694 | } | 2700 | } |
2695 | impl AstNode for LetStmt { | 2701 | impl AstNode for TuplePat { |
2696 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } | 2702 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } |
2697 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2703 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2698 | if Self::can_cast(syntax.kind()) { | 2704 | if Self::can_cast(syntax.kind()) { |
2699 | Some(Self { syntax }) | 2705 | Some(Self { syntax }) |
@@ -2703,8 +2709,8 @@ impl AstNode for LetStmt { | |||
2703 | } | 2709 | } |
2704 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2710 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2705 | } | 2711 | } |
2706 | impl AstNode for PathSegment { | 2712 | impl AstNode for TupleStructPat { |
2707 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2713 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } |
2708 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2714 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2709 | if Self::can_cast(syntax.kind()) { | 2715 | if Self::can_cast(syntax.kind()) { |
2710 | Some(Self { syntax }) | 2716 | Some(Self { syntax }) |
@@ -2714,8 +2720,8 @@ impl AstNode for PathSegment { | |||
2714 | } | 2720 | } |
2715 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2721 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2716 | } | 2722 | } |
2717 | impl AstNode for TypeArg { | 2723 | impl AstNode for RecordPatFieldList { |
2718 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } | 2724 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST } |
2719 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2725 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2720 | if Self::can_cast(syntax.kind()) { | 2726 | if Self::can_cast(syntax.kind()) { |
2721 | Some(Self { syntax }) | 2727 | Some(Self { syntax }) |
@@ -2725,8 +2731,8 @@ impl AstNode for TypeArg { | |||
2725 | } | 2731 | } |
2726 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2732 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2727 | } | 2733 | } |
2728 | impl AstNode for LifetimeArg { | 2734 | impl AstNode for RecordPatField { |
2729 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } | 2735 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD } |
2730 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2736 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2731 | if Self::can_cast(syntax.kind()) { | 2737 | if Self::can_cast(syntax.kind()) { |
2732 | Some(Self { syntax }) | 2738 | Some(Self { syntax }) |
@@ -2736,27 +2742,300 @@ impl AstNode for LifetimeArg { | |||
2736 | } | 2742 | } |
2737 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2743 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2738 | } | 2744 | } |
2739 | impl AstNode for AssocTypeArg { | 2745 | impl From<TypeArg> for GenericArg { |
2740 | fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } | 2746 | fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) } |
2747 | } | ||
2748 | impl From<AssocTypeArg> for GenericArg { | ||
2749 | fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) } | ||
2750 | } | ||
2751 | impl From<LifetimeArg> for GenericArg { | ||
2752 | fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } | ||
2753 | } | ||
2754 | impl From<ConstArg> for GenericArg { | ||
2755 | fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) } | ||
2756 | } | ||
2757 | impl AstNode for GenericArg { | ||
2758 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2759 | match kind { | ||
2760 | TYPE_ARG | ASSOC_TYPE_ARG | LIFETIME_ARG | CONST_ARG => true, | ||
2761 | _ => false, | ||
2762 | } | ||
2763 | } | ||
2741 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2764 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2742 | if Self::can_cast(syntax.kind()) { | 2765 | let res = match syntax.kind() { |
2743 | Some(Self { syntax }) | 2766 | TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }), |
2744 | } else { | 2767 | ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }), |
2745 | None | 2768 | LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }), |
2769 | CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }), | ||
2770 | _ => return None, | ||
2771 | }; | ||
2772 | Some(res) | ||
2773 | } | ||
2774 | fn syntax(&self) -> &SyntaxNode { | ||
2775 | match self { | ||
2776 | GenericArg::TypeArg(it) => &it.syntax, | ||
2777 | GenericArg::AssocTypeArg(it) => &it.syntax, | ||
2778 | GenericArg::LifetimeArg(it) => &it.syntax, | ||
2779 | GenericArg::ConstArg(it) => &it.syntax, | ||
2746 | } | 2780 | } |
2747 | } | 2781 | } |
2748 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2749 | } | 2782 | } |
2750 | impl AstNode for ConstArg { | 2783 | impl From<ArrayType> for Type { |
2751 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } | 2784 | fn from(node: ArrayType) -> Type { Type::ArrayType(node) } |
2785 | } | ||
2786 | impl From<DynTraitType> for Type { | ||
2787 | fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } | ||
2788 | } | ||
2789 | impl From<FnPtrType> for Type { | ||
2790 | fn from(node: FnPtrType) -> Type { Type::FnPtrType(node) } | ||
2791 | } | ||
2792 | impl From<ForType> for Type { | ||
2793 | fn from(node: ForType) -> Type { Type::ForType(node) } | ||
2794 | } | ||
2795 | impl From<ImplTraitType> for Type { | ||
2796 | fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } | ||
2797 | } | ||
2798 | impl From<InferType> for Type { | ||
2799 | fn from(node: InferType) -> Type { Type::InferType(node) } | ||
2800 | } | ||
2801 | impl From<NeverType> for Type { | ||
2802 | fn from(node: NeverType) -> Type { Type::NeverType(node) } | ||
2803 | } | ||
2804 | impl From<ParenType> for Type { | ||
2805 | fn from(node: ParenType) -> Type { Type::ParenType(node) } | ||
2806 | } | ||
2807 | impl From<PathType> for Type { | ||
2808 | fn from(node: PathType) -> Type { Type::PathType(node) } | ||
2809 | } | ||
2810 | impl From<PtrType> for Type { | ||
2811 | fn from(node: PtrType) -> Type { Type::PtrType(node) } | ||
2812 | } | ||
2813 | impl From<RefType> for Type { | ||
2814 | fn from(node: RefType) -> Type { Type::RefType(node) } | ||
2815 | } | ||
2816 | impl From<SliceType> for Type { | ||
2817 | fn from(node: SliceType) -> Type { Type::SliceType(node) } | ||
2818 | } | ||
2819 | impl From<TupleType> for Type { | ||
2820 | fn from(node: TupleType) -> Type { Type::TupleType(node) } | ||
2821 | } | ||
2822 | impl AstNode for Type { | ||
2823 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2824 | match kind { | ||
2825 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE | ||
2826 | | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE | SLICE_TYPE | ||
2827 | | TUPLE_TYPE => true, | ||
2828 | _ => false, | ||
2829 | } | ||
2830 | } | ||
2752 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2831 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2753 | if Self::can_cast(syntax.kind()) { | 2832 | let res = match syntax.kind() { |
2754 | Some(Self { syntax }) | 2833 | ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), |
2755 | } else { | 2834 | DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), |
2756 | None | 2835 | FN_PTR_TYPE => Type::FnPtrType(FnPtrType { syntax }), |
2836 | FOR_TYPE => Type::ForType(ForType { syntax }), | ||
2837 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), | ||
2838 | INFER_TYPE => Type::InferType(InferType { syntax }), | ||
2839 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), | ||
2840 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), | ||
2841 | PATH_TYPE => Type::PathType(PathType { syntax }), | ||
2842 | PTR_TYPE => Type::PtrType(PtrType { syntax }), | ||
2843 | REF_TYPE => Type::RefType(RefType { syntax }), | ||
2844 | SLICE_TYPE => Type::SliceType(SliceType { syntax }), | ||
2845 | TUPLE_TYPE => Type::TupleType(TupleType { syntax }), | ||
2846 | _ => return None, | ||
2847 | }; | ||
2848 | Some(res) | ||
2849 | } | ||
2850 | fn syntax(&self) -> &SyntaxNode { | ||
2851 | match self { | ||
2852 | Type::ArrayType(it) => &it.syntax, | ||
2853 | Type::DynTraitType(it) => &it.syntax, | ||
2854 | Type::FnPtrType(it) => &it.syntax, | ||
2855 | Type::ForType(it) => &it.syntax, | ||
2856 | Type::ImplTraitType(it) => &it.syntax, | ||
2857 | Type::InferType(it) => &it.syntax, | ||
2858 | Type::NeverType(it) => &it.syntax, | ||
2859 | Type::ParenType(it) => &it.syntax, | ||
2860 | Type::PathType(it) => &it.syntax, | ||
2861 | Type::PtrType(it) => &it.syntax, | ||
2862 | Type::RefType(it) => &it.syntax, | ||
2863 | Type::SliceType(it) => &it.syntax, | ||
2864 | Type::TupleType(it) => &it.syntax, | ||
2865 | } | ||
2866 | } | ||
2867 | } | ||
2868 | impl From<ArrayExpr> for Expr { | ||
2869 | fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } | ||
2870 | } | ||
2871 | impl From<AwaitExpr> for Expr { | ||
2872 | fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) } | ||
2873 | } | ||
2874 | impl From<BinExpr> for Expr { | ||
2875 | fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } | ||
2876 | } | ||
2877 | impl From<BlockExpr> for Expr { | ||
2878 | fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) } | ||
2879 | } | ||
2880 | impl From<BoxExpr> for Expr { | ||
2881 | fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) } | ||
2882 | } | ||
2883 | impl From<BreakExpr> for Expr { | ||
2884 | fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) } | ||
2885 | } | ||
2886 | impl From<CallExpr> for Expr { | ||
2887 | fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } | ||
2888 | } | ||
2889 | impl From<CastExpr> for Expr { | ||
2890 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | ||
2891 | } | ||
2892 | impl From<ClosureExpr> for Expr { | ||
2893 | fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) } | ||
2894 | } | ||
2895 | impl From<ContinueExpr> for Expr { | ||
2896 | fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } | ||
2897 | } | ||
2898 | impl From<EffectExpr> for Expr { | ||
2899 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } | ||
2900 | } | ||
2901 | impl From<FieldExpr> for Expr { | ||
2902 | fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) } | ||
2903 | } | ||
2904 | impl From<ForExpr> for Expr { | ||
2905 | fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) } | ||
2906 | } | ||
2907 | impl From<IfExpr> for Expr { | ||
2908 | fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) } | ||
2909 | } | ||
2910 | impl From<IndexExpr> for Expr { | ||
2911 | fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } | ||
2912 | } | ||
2913 | impl From<Literal> for Expr { | ||
2914 | fn from(node: Literal) -> Expr { Expr::Literal(node) } | ||
2915 | } | ||
2916 | impl From<LoopExpr> for Expr { | ||
2917 | fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) } | ||
2918 | } | ||
2919 | impl From<MacroCall> for Expr { | ||
2920 | fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) } | ||
2921 | } | ||
2922 | impl From<MatchExpr> for Expr { | ||
2923 | fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } | ||
2924 | } | ||
2925 | impl From<MethodCallExpr> for Expr { | ||
2926 | fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) } | ||
2927 | } | ||
2928 | impl From<ParenExpr> for Expr { | ||
2929 | fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) } | ||
2930 | } | ||
2931 | impl From<PathExpr> for Expr { | ||
2932 | fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) } | ||
2933 | } | ||
2934 | impl From<PrefixExpr> for Expr { | ||
2935 | fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) } | ||
2936 | } | ||
2937 | impl From<RangeExpr> for Expr { | ||
2938 | fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) } | ||
2939 | } | ||
2940 | impl From<RecordExpr> for Expr { | ||
2941 | fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } | ||
2942 | } | ||
2943 | impl From<RefExpr> for Expr { | ||
2944 | fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) } | ||
2945 | } | ||
2946 | impl From<ReturnExpr> for Expr { | ||
2947 | fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) } | ||
2948 | } | ||
2949 | impl From<TryExpr> for Expr { | ||
2950 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } | ||
2951 | } | ||
2952 | impl From<TupleExpr> for Expr { | ||
2953 | fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } | ||
2954 | } | ||
2955 | impl From<WhileExpr> for Expr { | ||
2956 | fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } | ||
2957 | } | ||
2958 | impl AstNode for Expr { | ||
2959 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2960 | match kind { | ||
2961 | ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR | ||
2962 | | CAST_EXPR | CLOSURE_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | ||
2963 | | IF_EXPR | INDEX_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR | ||
2964 | | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR | ||
2965 | | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true, | ||
2966 | _ => false, | ||
2967 | } | ||
2968 | } | ||
2969 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2970 | let res = match syntax.kind() { | ||
2971 | ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), | ||
2972 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), | ||
2973 | BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), | ||
2974 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), | ||
2975 | BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }), | ||
2976 | BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), | ||
2977 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), | ||
2978 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | ||
2979 | CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }), | ||
2980 | CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }), | ||
2981 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | ||
2982 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | ||
2983 | FOR_EXPR => Expr::ForExpr(ForExpr { syntax }), | ||
2984 | IF_EXPR => Expr::IfExpr(IfExpr { syntax }), | ||
2985 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), | ||
2986 | LITERAL => Expr::Literal(Literal { syntax }), | ||
2987 | LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), | ||
2988 | MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), | ||
2989 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), | ||
2990 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), | ||
2991 | PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }), | ||
2992 | PATH_EXPR => Expr::PathExpr(PathExpr { syntax }), | ||
2993 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), | ||
2994 | RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }), | ||
2995 | RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), | ||
2996 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), | ||
2997 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), | ||
2998 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), | ||
2999 | TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }), | ||
3000 | WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }), | ||
3001 | _ => return None, | ||
3002 | }; | ||
3003 | Some(res) | ||
3004 | } | ||
3005 | fn syntax(&self) -> &SyntaxNode { | ||
3006 | match self { | ||
3007 | Expr::ArrayExpr(it) => &it.syntax, | ||
3008 | Expr::AwaitExpr(it) => &it.syntax, | ||
3009 | Expr::BinExpr(it) => &it.syntax, | ||
3010 | Expr::BlockExpr(it) => &it.syntax, | ||
3011 | Expr::BoxExpr(it) => &it.syntax, | ||
3012 | Expr::BreakExpr(it) => &it.syntax, | ||
3013 | Expr::CallExpr(it) => &it.syntax, | ||
3014 | Expr::CastExpr(it) => &it.syntax, | ||
3015 | Expr::ClosureExpr(it) => &it.syntax, | ||
3016 | Expr::ContinueExpr(it) => &it.syntax, | ||
3017 | Expr::EffectExpr(it) => &it.syntax, | ||
3018 | Expr::FieldExpr(it) => &it.syntax, | ||
3019 | Expr::ForExpr(it) => &it.syntax, | ||
3020 | Expr::IfExpr(it) => &it.syntax, | ||
3021 | Expr::IndexExpr(it) => &it.syntax, | ||
3022 | Expr::Literal(it) => &it.syntax, | ||
3023 | Expr::LoopExpr(it) => &it.syntax, | ||
3024 | Expr::MacroCall(it) => &it.syntax, | ||