aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs26
-rw-r--r--crates/ra_syntax/src/ast/expr_extensions.rs4
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs147
-rw-r--r--crates/ra_syntax/src/ast/generated.rs2091
-rw-r--r--crates/ra_syntax/src/ast/traits.rs10
5 files changed, 2019 insertions, 259 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index b69cae234..d79310995 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -99,7 +99,7 @@ impl ast::ItemList {
99 None => match self.l_curly() { 99 None => match self.l_curly() {
100 Some(it) => ( 100 Some(it) => (
101 " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), 101 " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(),
102 InsertPosition::After(it), 102 InsertPosition::After(it.syntax().clone().into()),
103 ), 103 ),
104 None => return self.clone(), 104 None => return self.clone(),
105 }, 105 },
@@ -109,10 +109,6 @@ impl ast::ItemList {
109 [ws.ws().into(), item.syntax().clone().into()].into(); 109 [ws.ws().into(), item.syntax().clone().into()].into();
110 self.insert_children(position, to_insert) 110 self.insert_children(position, to_insert)
111 } 111 }
112
113 fn l_curly(&self) -> Option<SyntaxElement> {
114 self.syntax().children_with_tokens().find(|it| it.kind() == T!['{'])
115 }
116} 112}
117 113
118impl ast::RecordFieldList { 114impl ast::RecordFieldList {
@@ -147,7 +143,7 @@ impl ast::RecordFieldList {
147 macro_rules! after_l_curly { 143 macro_rules! after_l_curly {
148 () => {{ 144 () => {{
149 let anchor = match self.l_curly() { 145 let anchor = match self.l_curly() {
150 Some(it) => it, 146 Some(it) => it.syntax().clone().into(),
151 None => return self.clone(), 147 None => return self.clone(),
152 }; 148 };
153 InsertPosition::After(anchor) 149 InsertPosition::After(anchor)
@@ -189,24 +185,20 @@ impl ast::RecordFieldList {
189 185
190 self.insert_children(position, to_insert) 186 self.insert_children(position, to_insert)
191 } 187 }
192
193 fn l_curly(&self) -> Option<SyntaxElement> {
194 self.syntax().children_with_tokens().find(|it| it.kind() == T!['{'])
195 }
196} 188}
197 189
198impl ast::TypeParam { 190impl ast::TypeParam {
199 #[must_use] 191 #[must_use]
200 pub fn remove_bounds(&self) -> ast::TypeParam { 192 pub fn remove_bounds(&self) -> ast::TypeParam {
201 let colon = match self.colon_token() { 193 let colon = match self.colon() {
202 Some(it) => it, 194 Some(it) => it,
203 None => return self.clone(), 195 None => return self.clone(),
204 }; 196 };
205 let end = match self.type_bound_list() { 197 let end = match self.type_bound_list() {
206 Some(it) => it.syntax().clone().into(), 198 Some(it) => it.syntax().clone().into(),
207 None => colon.clone().into(), 199 None => colon.syntax().clone().into(),
208 }; 200 };
209 self.replace_children(colon.into()..=end, iter::empty()) 201 self.replace_children(colon.syntax().clone().into()..=end, iter::empty())
210 } 202 }
211} 203}
212 204
@@ -305,8 +297,12 @@ impl ast::UseTree {
305 Some(it) => it, 297 Some(it) => it,
306 None => return self.clone(), 298 None => return self.clone(),
307 }; 299 };
308 let use_tree = 300 let use_tree = make::use_tree(
309 make::use_tree(suffix.clone(), self.use_tree_list(), self.alias(), self.has_star()); 301 suffix.clone(),
302 self.use_tree_list(),
303 self.alias(),
304 self.star().is_some(),
305 );
310 let nested = make::use_tree_list(iter::once(use_tree)); 306 let nested = make::use_tree_list(iter::once(use_tree));
311 return make::use_tree(prefix.clone(), Some(nested), None, false); 307 return make::use_tree(prefix.clone(), Some(nested), None, false);
312 308
diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs
index 8bbd946c0..40c8fca3b 100644
--- a/crates/ra_syntax/src/ast/expr_extensions.rs
+++ b/crates/ra_syntax/src/ast/expr_extensions.rs
@@ -52,6 +52,10 @@ impl ast::RefExpr {
52 pub fn is_mut(&self) -> bool { 52 pub fn is_mut(&self) -> bool {
53 self.syntax().children_with_tokens().any(|n| n.kind() == T![mut]) 53 self.syntax().children_with_tokens().any(|n| n.kind() == T![mut])
54 } 54 }
55
56 pub fn raw_token(&self) -> Option<SyntaxToken> {
57 None // FIXME: implement &raw
58 }
55} 59}
56 60
57#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] 61#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index bf7d137be..33fe60762 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -4,7 +4,9 @@
4use itertools::Itertools; 4use itertools::Itertools;
5 5
6use crate::{ 6use crate::{
7 ast::{self, child_opt, children, AstNode, AttrInput, NameOwner, SyntaxNode}, 7 ast::{
8 self, child_opt, children, support, AstNode, AstToken, AttrInput, NameOwner, SyntaxNode,
9 },
8 SmolStr, SyntaxElement, 10 SmolStr, SyntaxElement,
9 SyntaxKind::*, 11 SyntaxKind::*,
10 SyntaxToken, T, 12 SyntaxToken, T,
@@ -130,13 +132,6 @@ impl ast::PathSegment {
130 }; 132 };
131 Some(res) 133 Some(res)
132 } 134 }
133
134 pub fn has_colon_colon(&self) -> bool {
135 match self.syntax.first_child_or_token().map(|s| s.kind()) {
136 Some(T![::]) => true,
137 _ => false,
138 }
139 }
140} 135}
141 136
142impl ast::Path { 137impl ast::Path {
@@ -154,12 +149,6 @@ impl ast::Module {
154 } 149 }
155} 150}
156 151
157impl ast::UseTree {
158 pub fn has_star(&self) -> bool {
159 self.syntax().children_with_tokens().any(|it| it.kind() == T![*])
160 }
161}
162
163impl ast::UseTreeList { 152impl ast::UseTreeList {
164 pub fn parent_use_tree(&self) -> ast::UseTree { 153 pub fn parent_use_tree(&self) -> ast::UseTree {
165 self.syntax() 154 self.syntax()
@@ -167,20 +156,6 @@ impl ast::UseTreeList {
167 .and_then(ast::UseTree::cast) 156 .and_then(ast::UseTree::cast)
168 .expect("UseTreeLists are always nested in UseTrees") 157 .expect("UseTreeLists are always nested in UseTrees")
169 } 158 }
170 pub fn l_curly(&self) -> Option<SyntaxToken> {
171 self.token(T!['{'])
172 }
173
174 pub fn r_curly(&self) -> Option<SyntaxToken> {
175 self.token(T!['}'])
176 }
177
178 fn token(&self, kind: SyntaxKind) -> Option<SyntaxToken> {
179 self.syntax()
180 .children_with_tokens()
181 .filter_map(|it| it.into_token())
182 .find(|it| it.kind() == kind)
183 }
184} 159}
185 160
186impl ast::ImplDef { 161impl ast::ImplDef {
@@ -387,24 +362,9 @@ pub enum SelfParamKind {
387} 362}
388 363
389impl ast::SelfParam { 364impl ast::SelfParam {
390 pub fn self_kw_token(&self) -> SyntaxToken {
391 self.syntax()
392 .children_with_tokens()
393 .filter_map(|it| it.into_token())
394 .find(|it| it.kind() == T![self])
395 .expect("invalid tree: self param must have self")
396 }
397
398 pub fn kind(&self) -> SelfParamKind { 365 pub fn kind(&self) -> SelfParamKind {
399 let borrowed = self.syntax().children_with_tokens().any(|n| n.kind() == T![&]); 366 if self.amp().is_some() {
400 if borrowed { 367 if self.amp_mut_kw().is_some() {
401 // check for a `mut` coming after the & -- `mut &self` != `&mut self`
402 if self
403 .syntax()
404 .children_with_tokens()
405 .skip_while(|n| n.kind() != T![&])
406 .any(|n| n.kind() == T![mut])
407 {
408 SelfParamKind::MutRef 368 SelfParamKind::MutRef
409 } else { 369 } else {
410 SelfParamKind::Ref 370 SelfParamKind::Ref
@@ -413,32 +373,23 @@ impl ast::SelfParam {
413 SelfParamKind::Owned 373 SelfParamKind::Owned
414 } 374 }
415 } 375 }
416}
417 376
418impl ast::LifetimeParam { 377 /// the "mut" in "mut self", not the one in "&mut self"
419 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 378 pub fn mut_kw(&self) -> Option<ast::MutKw> {
420 self.syntax() 379 self.syntax()
421 .children_with_tokens() 380 .children_with_tokens()
422 .filter_map(|it| it.into_token()) 381 .filter_map(|it| it.into_token())
423 .find(|it| it.kind() == LIFETIME) 382 .take_while(|it| it.kind() != T![&])
383 .find_map(ast::MutKw::cast)
424 } 384 }
425}
426 385
427impl ast::TypeParam { 386 /// the "mut" in "&mut self", not the one in "mut self"
428 pub fn colon_token(&self) -> Option<SyntaxToken> { 387 pub fn amp_mut_kw(&self) -> Option<ast::MutKw> {
429 self.syntax() 388 self.syntax()
430 .children_with_tokens() 389 .children_with_tokens()
431 .filter_map(|it| it.into_token()) 390 .filter_map(|it| it.into_token())
432 .find(|it| it.kind() == T![:]) 391 .skip_while(|it| it.kind() != T![&])
433 } 392 .find_map(ast::MutKw::cast)
434}
435
436impl ast::WherePred {
437 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
438 self.syntax()
439 .children_with_tokens()
440 .filter_map(|it| it.into_token())
441 .find(|it| it.kind() == LIFETIME)
442 } 393 }
443} 394}
444 395
@@ -449,7 +400,7 @@ pub enum TypeBoundKind {
449 /// for<'a> ... 400 /// for<'a> ...
450 ForType(ast::ForType), 401 ForType(ast::ForType),
451 /// 'a 402 /// 'a
452 Lifetime(ast::SyntaxToken), 403 Lifetime(ast::Lifetime),
453} 404}
454 405
455impl ast::TypeBound { 406impl ast::TypeBound {
@@ -465,21 +416,28 @@ impl ast::TypeBound {
465 } 416 }
466 } 417 }
467 418
468 fn lifetime(&self) -> Option<SyntaxToken> { 419 pub fn has_question_mark(&self) -> bool {
469 self.syntax() 420 self.question().is_some()
470 .children_with_tokens()
471 .filter_map(|it| it.into_token())
472 .find(|it| it.kind() == LIFETIME)
473 } 421 }
474 422
475 pub fn question_mark_token(&self) -> Option<SyntaxToken> { 423 pub fn const_question(&self) -> Option<ast::Question> {
476 self.syntax() 424 self.syntax()
477 .children_with_tokens() 425 .children_with_tokens()
478 .filter_map(|it| it.into_token()) 426 .filter_map(|it| it.into_token())
479 .find(|it| it.kind() == T![?]) 427 .take_while(|it| it.kind() != T![const])
428 .find_map(ast::Question::cast)
480 } 429 }
481 pub fn has_question_mark(&self) -> bool { 430
482 self.question_mark_token().is_some() 431 pub fn question(&self) -> Option<ast::Question> {
432 if self.const_kw().is_some() {
433 self.syntax()
434 .children_with_tokens()
435 .filter_map(|it| it.into_token())
436 .skip_while(|it| it.kind() != T![const])
437 .find_map(ast::Question::cast)
438 } else {
439 support::token(&self.syntax)
440 }
483 } 441 }
484} 442}
485 443
@@ -493,6 +451,7 @@ pub enum VisibilityKind {
493 In(ast::Path), 451 In(ast::Path),
494 PubCrate, 452 PubCrate,
495 PubSuper, 453 PubSuper,
454 PubSelf,
496 Pub, 455 Pub,
497} 456}
498 457
@@ -504,6 +463,8 @@ impl ast::Visibility {
504 VisibilityKind::PubCrate 463 VisibilityKind::PubCrate
505 } else if self.is_pub_super() { 464 } else if self.is_pub_super() {
506 VisibilityKind::PubSuper 465 VisibilityKind::PubSuper
466 } else if self.is_pub_self() {
467 VisibilityKind::PubSuper
507 } else { 468 } else {
508 VisibilityKind::Pub 469 VisibilityKind::Pub
509 } 470 }
@@ -516,6 +477,10 @@ impl ast::Visibility {
516 fn is_pub_super(&self) -> bool { 477 fn is_pub_super(&self) -> bool {
517 self.syntax().children_with_tokens().any(|it| it.kind() == T![super]) 478 self.syntax().children_with_tokens().any(|it| it.kind() == T![super])
518 } 479 }
480
481 fn is_pub_self(&self) -> bool {
482 self.syntax().children_with_tokens().any(|it| it.kind() == T![self])
483 }
519} 484}
520 485
521impl ast::MacroCall { 486impl ast::MacroCall {
@@ -528,3 +493,41 @@ impl ast::MacroCall {
528 } 493 }
529 } 494 }
530} 495}
496
497impl ast::LifetimeParam {
498 pub fn lifetime_bounds(&self) -> impl Iterator<Item = ast::Lifetime> {
499 self.syntax()
500 .children_with_tokens()
501 .filter_map(|it| it.into_token())
502 .skip_while(|x| x.kind() != T![:])
503 .filter_map(ast::Lifetime::cast)
504 }
505}
506
507impl ast::RangePat {
508 pub fn start(&self) -> Option<ast::Pat> {
509 self.syntax()
510 .children_with_tokens()
511 .take_while(|it| !ast::RangeSeparator::can_cast(it.kind()))
512 .filter_map(|it| it.into_node())
513 .find_map(ast::Pat::cast)
514 }
515
516 pub fn end(&self) -> Option<ast::Pat> {
517 self.syntax()
518 .children_with_tokens()
519 .skip_while(|it| !ast::RangeSeparator::can_cast(it.kind()))
520 .filter_map(|it| it.into_node())
521 .find_map(ast::Pat::cast)
522 }
523}
524
525impl ast::TokenTree {
526 pub fn left_delimiter(&self) -> Option<ast::LeftDelimiter> {
527 self.syntax().first_child_or_token()?.into_token().and_then(ast::LeftDelimiter::cast)
528 }
529
530 pub fn right_delimiter(&self) -> Option<ast::RightDelimiter> {
531 self.syntax().last_child_or_token()?.into_token().and_then(ast::RightDelimiter::cast)
532 }
533}
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 385fddc89..bd92e9c87 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -2,7 +2,7 @@
2 2
3#[allow(unused_imports)] 3#[allow(unused_imports)]
4use crate::{ 4use crate::{
5 ast::{self, AstChildren, AstNode, AstToken}, 5 ast::{self, support, AstChildren, AstNode, AstToken},
6 NodeOrToken, SyntaxElement, 6 NodeOrToken, SyntaxElement,
7 SyntaxKind::{self, *}, 7 SyntaxKind::{self, *},
8 SyntaxNode, SyntaxToken, 8 SyntaxNode, SyntaxToken,
@@ -2600,6 +2600,33 @@ impl AstToken for UnionKw {
2600 } 2600 }
2601} 2601}
2602#[derive(Debug, Clone, PartialEq, Eq, Hash)] 2602#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2603pub struct RawKw {
2604 pub(crate) syntax: SyntaxToken,
2605}
2606impl std::fmt::Display for RawKw {
2607 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2608 std::fmt::Display::fmt(&self.syntax, f)
2609 }
2610}
2611impl AstToken for RawKw {
2612 fn can_cast(kind: SyntaxKind) -> bool {
2613 match kind {
2614 RAW_KW => true,
2615 _ => false,
2616 }
2617 }
2618 fn cast(syntax: SyntaxToken) -> Option<Self> {
2619 if Self::can_cast(syntax.kind()) {
2620 Some(Self { syntax })
2621 } else {
2622 None
2623 }
2624 }
2625 fn syntax(&self) -> &SyntaxToken {
2626 &self.syntax
2627 }
2628}
2629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2603pub struct IntNumber { 2630pub struct IntNumber {
2604 pub(crate) syntax: SyntaxToken, 2631 pub(crate) syntax: SyntaxToken,
2605} 2632}
@@ -3060,9 +3087,10 @@ impl AstNode for SourceFile {
3060} 3087}
3061impl ast::ModuleItemOwner for SourceFile {} 3088impl ast::ModuleItemOwner for SourceFile {}
3062impl ast::FnDefOwner for SourceFile {} 3089impl ast::FnDefOwner for SourceFile {}
3090impl ast::AttrsOwner for SourceFile {}
3063impl SourceFile { 3091impl SourceFile {
3064 pub fn modules(&self) -> AstChildren<Module> { 3092 pub fn modules(&self) -> AstChildren<Module> {
3065 AstChildren::new(&self.syntax) 3093 support::children(&self.syntax)
3066 } 3094 }
3067} 3095}
3068#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3096#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3098,14 +3126,35 @@ impl ast::TypeParamsOwner for FnDef {}
3098impl ast::DocCommentsOwner for FnDef {} 3126impl ast::DocCommentsOwner for FnDef {}
3099impl ast::AttrsOwner for FnDef {} 3127impl ast::AttrsOwner for FnDef {}
3100impl FnDef { 3128impl FnDef {
3129 pub fn abi(&self) -> Option<Abi> {
3130 support::child(&self.syntax)
3131 }
3132 pub fn const_kw(&self) -> Option<ConstKw> {
3133 support::token(&self.syntax)
3134 }
3135 pub fn default_kw(&self) -> Option<DefaultKw> {
3136 support::token(&self.syntax)
3137 }
3138 pub fn async_kw(&self) -> Option<AsyncKw> {
3139 support::token(&self.syntax)
3140 }
3141 pub fn unsafe_kw(&self) -> Option<UnsafeKw> {
3142 support::token(&self.syntax)
3143 }
3144 pub fn fn_kw(&self) -> Option<FnKw> {
3145 support::token(&self.syntax)
3146 }
3101 pub fn param_list(&self) -> Option<ParamList> { 3147 pub fn param_list(&self) -> Option<ParamList> {
3102 AstChildren::new(&self.syntax).next() 3148 support::child(&self.syntax)
3103 } 3149 }
3104 pub fn ret_type(&self) -> Option<RetType> { 3150 pub fn ret_type(&self) -> Option<RetType> {
3105 AstChildren::new(&self.syntax).next() 3151 support::child(&self.syntax)
3106 } 3152 }
3107 pub fn body(&self) -> Option<BlockExpr> { 3153 pub fn body(&self) -> Option<BlockExpr> {
3108 AstChildren::new(&self.syntax).next() 3154 support::child(&self.syntax)
3155 }
3156 pub fn semi(&self) -> Option<Semi> {
3157 support::token(&self.syntax)
3109 } 3158 }
3110} 3159}
3111#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3160#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3136,8 +3185,11 @@ impl AstNode for RetType {
3136 } 3185 }
3137} 3186}
3138impl RetType { 3187impl RetType {
3188 pub fn thin_arrow(&self) -> Option<ThinArrow> {
3189 support::token(&self.syntax)
3190 }
3139 pub fn type_ref(&self) -> Option<TypeRef> { 3191 pub fn type_ref(&self) -> Option<TypeRef> {
3140 AstChildren::new(&self.syntax).next() 3192 support::child(&self.syntax)
3141 } 3193 }
3142} 3194}
3143#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3195#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3172,7 +3224,17 @@ impl ast::NameOwner for StructDef {}
3172impl ast::TypeParamsOwner for StructDef {} 3224impl ast::TypeParamsOwner for StructDef {}
3173impl ast::AttrsOwner for StructDef {} 3225impl ast::AttrsOwner for StructDef {}
3174impl ast::DocCommentsOwner for StructDef {} 3226impl ast::DocCommentsOwner for StructDef {}
3175impl StructDef {} 3227impl StructDef {
3228 pub fn struct_kw(&self) -> Option<StructKw> {
3229 support::token(&self.syntax)
3230 }
3231 pub fn field_def_list(&self) -> Option<FieldDefList> {
3232 support::child(&self.syntax)
3233 }
3234 pub fn semi(&self) -> Option<Semi> {
3235 support::token(&self.syntax)
3236 }
3237}
3176#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3238#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3177pub struct UnionDef { 3239pub struct UnionDef {
3178 pub(crate) syntax: SyntaxNode, 3240 pub(crate) syntax: SyntaxNode,
@@ -3206,8 +3268,11 @@ impl ast::TypeParamsOwner for UnionDef {}
3206impl ast::AttrsOwner for UnionDef {} 3268impl ast::AttrsOwner for UnionDef {}
3207impl ast::DocCommentsOwner for UnionDef {} 3269impl ast::DocCommentsOwner for UnionDef {}
3208impl UnionDef { 3270impl UnionDef {
3271 pub fn union_kw(&self) -> Option<UnionKw> {
3272 support::token(&self.syntax)
3273 }
3209 pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { 3274 pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
3210 AstChildren::new(&self.syntax).next() 3275 support::child(&self.syntax)
3211 } 3276 }
3212} 3277}
3213#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3278#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3238,8 +3303,14 @@ impl AstNode for RecordFieldDefList {
3238 } 3303 }
3239} 3304}
3240impl RecordFieldDefList { 3305impl RecordFieldDefList {
3306 pub fn l_curly(&self) -> Option<LCurly> {
3307 support::token(&self.syntax)
3308 }
3241 pub fn fields(&self) -> AstChildren<RecordFieldDef> { 3309 pub fn fields(&self) -> AstChildren<RecordFieldDef> {
3242 AstChildren::new(&self.syntax) 3310 support::children(&self.syntax)
3311 }
3312 pub fn r_curly(&self) -> Option<RCurly> {
3313 support::token(&self.syntax)
3243 } 3314 }
3244} 3315}
3245#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3316#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3303,8 +3374,14 @@ impl AstNode for TupleFieldDefList {
3303 } 3374 }
3304} 3375}
3305impl TupleFieldDefList { 3376impl TupleFieldDefList {
3377 pub fn l_paren(&self) -> Option<LParen> {
3378 support::token(&self.syntax)
3379 }
3306 pub fn fields(&self) -> AstChildren<TupleFieldDef> { 3380 pub fn fields(&self) -> AstChildren<TupleFieldDef> {
3307 AstChildren::new(&self.syntax) 3381 support::children(&self.syntax)
3382 }
3383 pub fn r_paren(&self) -> Option<RParen> {
3384 support::token(&self.syntax)
3308 } 3385 }
3309} 3386}
3310#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3387#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3338,7 +3415,7 @@ impl ast::VisibilityOwner for TupleFieldDef {}
3338impl ast::AttrsOwner for TupleFieldDef {} 3415impl ast::AttrsOwner for TupleFieldDef {}
3339impl TupleFieldDef { 3416impl TupleFieldDef {
3340 pub fn type_ref(&self) -> Option<TypeRef> { 3417 pub fn type_ref(&self) -> Option<TypeRef> {
3341 AstChildren::new(&self.syntax).next() 3418 support::child(&self.syntax)
3342 } 3419 }
3343} 3420}
3344#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3421#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3374,8 +3451,11 @@ impl ast::TypeParamsOwner for EnumDef {}
3374impl ast::AttrsOwner for EnumDef {} 3451impl ast::AttrsOwner for EnumDef {}
3375impl ast::DocCommentsOwner for EnumDef {} 3452impl ast::DocCommentsOwner for EnumDef {}
3376impl EnumDef { 3453impl EnumDef {
3454 pub fn enum_kw(&self) -> Option<EnumKw> {
3455 support::token(&self.syntax)
3456 }
3377 pub fn variant_list(&self) -> Option<EnumVariantList> { 3457 pub fn variant_list(&self) -> Option<EnumVariantList> {
3378 AstChildren::new(&self.syntax).next() 3458 support::child(&self.syntax)
3379 } 3459 }
3380} 3460}
3381#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3461#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3406,8 +3486,14 @@ impl AstNode for EnumVariantList {
3406 } 3486 }
3407} 3487}
3408impl EnumVariantList { 3488impl EnumVariantList {
3489 pub fn l_curly(&self) -> Option<LCurly> {
3490 support::token(&self.syntax)
3491 }
3409 pub fn variants(&self) -> AstChildren<EnumVariant> { 3492 pub fn variants(&self) -> AstChildren<EnumVariant> {
3410 AstChildren::new(&self.syntax) 3493 support::children(&self.syntax)
3494 }
3495 pub fn r_curly(&self) -> Option<RCurly> {
3496 support::token(&self.syntax)
3411 } 3497 }
3412} 3498}
3413#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3499#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3437,12 +3523,19 @@ impl AstNode for EnumVariant {
3437 &self.syntax 3523 &self.syntax
3438 } 3524 }
3439} 3525}
3526impl ast::VisibilityOwner for EnumVariant {}
3440impl ast::NameOwner for EnumVariant {} 3527impl ast::NameOwner for EnumVariant {}
3441impl ast::DocCommentsOwner for EnumVariant {} 3528impl ast::DocCommentsOwner for EnumVariant {}
3442impl ast::AttrsOwner for EnumVariant {} 3529impl ast::AttrsOwner for EnumVariant {}
3443impl EnumVariant { 3530impl EnumVariant {
3531 pub fn field_def_list(&self) -> Option<FieldDefList> {
3532 support::child(&self.syntax)
3533 }
3534 pub fn eq(&self) -> Option<Eq> {
3535 support::token(&self.syntax)
3536 }
3444 pub fn expr(&self) -> Option<Expr> { 3537 pub fn expr(&self) -> Option<Expr> {
3445 AstChildren::new(&self.syntax).next() 3538 support::child(&self.syntax)
3446 } 3539 }
3447} 3540}
3448#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3541#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3479,8 +3572,17 @@ impl ast::DocCommentsOwner for TraitDef {}
3479impl ast::TypeParamsOwner for TraitDef {} 3572impl ast::TypeParamsOwner for TraitDef {}
3480impl ast::TypeBoundsOwner for TraitDef {} 3573impl ast::TypeBoundsOwner for TraitDef {}
3481impl TraitDef { 3574impl TraitDef {
3575 pub fn unsafe_kw(&self) -> Option<UnsafeKw> {
3576 support::token(&self.syntax)
3577 }
3578 pub fn auto_kw(&self) -> Option<AutoKw> {
3579 support::token(&self.syntax)
3580 }
3581 pub fn trait_kw(&self) -> Option<TraitKw> {
3582 support::token(&self.syntax)
3583 }
3482 pub fn item_list(&self) -> Option<ItemList> { 3584 pub fn item_list(&self) -> Option<ItemList> {
3483 AstChildren::new(&self.syntax).next() 3585 support::child(&self.syntax)
3484 } 3586 }
3485} 3587}
3486#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3588#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3515,8 +3617,14 @@ impl ast::NameOwner for Module {}
3515impl ast::AttrsOwner for Module {} 3617impl ast::AttrsOwner for Module {}
3516impl ast::DocCommentsOwner for Module {} 3618impl ast::DocCommentsOwner for Module {}
3517impl Module { 3619impl Module {
3620 pub fn mod_kw(&self) -> Option<ModKw> {
3621 support::token(&self.syntax)
3622 }
3518 pub fn item_list(&self) -> Option<ItemList> { 3623 pub fn item_list(&self) -> Option<ItemList> {
3519 AstChildren::new(&self.syntax).next() 3624 support::child(&self.syntax)
3625 }
3626 pub fn semi(&self) -> Option<Semi> {
3627 support::token(&self.syntax)
3520 } 3628 }
3521} 3629}
3522#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3630#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3549,8 +3657,14 @@ impl AstNode for ItemList {
3549impl ast::FnDefOwner for ItemList {} 3657impl ast::FnDefOwner for ItemList {}
3550impl ast::ModuleItemOwner for ItemList {} 3658impl ast::ModuleItemOwner for ItemList {}
3551impl ItemList { 3659impl ItemList {
3660 pub fn l_curly(&self) -> Option<LCurly> {
3661 support::token(&self.syntax)
3662 }
3552 pub fn impl_items(&self) -> AstChildren<ImplItem> { 3663 pub fn impl_items(&self) -> AstChildren<ImplItem> {
3553 AstChildren::new(&self.syntax) 3664 support::children(&self.syntax)
3665 }
3666 pub fn r_curly(&self) -> Option<RCurly> {
3667 support::token(&self.syntax)
3554 } 3668 }
3555} 3669}
3556#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3670#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3587,8 +3701,20 @@ impl ast::AttrsOwner for ConstDef {}
3587impl ast::DocCommentsOwner for ConstDef {} 3701impl ast::DocCommentsOwner for ConstDef {}
3588impl ast::TypeAscriptionOwner for ConstDef {} 3702impl ast::TypeAscriptionOwner for ConstDef {}
3589impl ConstDef { 3703impl ConstDef {
3704 pub fn default_kw(&self) -> Option<DefaultKw> {
3705 support::token(&self.syntax)
3706 }
3707 pub fn const_kw(&self) -> Option<ConstKw> {
3708 support::token(&self.syntax)
3709 }
3710 pub fn eq(&self) -> Option<Eq> {
3711 support::token(&self.syntax)
3712 }
3590 pub fn body(&self) -> Option<Expr> { 3713 pub fn body(&self) -> Option<Expr> {
3591 AstChildren::new(&self.syntax).next() 3714 support::child(&self.syntax)
3715 }
3716 pub fn semi(&self) -> Option<Semi> {
3717 support::token(&self.syntax)
3592 } 3718 }
3593} 3719}
3594#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3720#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3625,8 +3751,20 @@ impl ast::AttrsOwner for StaticDef {}
3625impl ast::DocCommentsOwner for StaticDef {} 3751impl ast::DocCommentsOwner for StaticDef {}
3626impl ast::TypeAscriptionOwner for StaticDef {} 3752impl ast::TypeAscriptionOwner for StaticDef {}
3627impl StaticDef { 3753impl StaticDef {
3754 pub fn static_kw(&self) -> Option<StaticKw> {
3755 support::token(&self.syntax)
3756 }
3757 pub fn mut_kw(&self) -> Option<MutKw> {
3758 support::token(&self.syntax)
3759 }
3760 pub fn eq(&self) -> Option<Eq> {
3761 support::token(&self.syntax)
3762 }
3628 pub fn body(&self) -> Option<Expr> { 3763 pub fn body(&self) -> Option<Expr> {
3629 AstChildren::new(&self.syntax).next() 3764 support::child(&self.syntax)
3765 }
3766 pub fn semi(&self) -> Option<Semi> {
3767 support::token(&self.syntax)
3630 } 3768 }
3631} 3769}
3632#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3770#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3663,8 +3801,20 @@ impl ast::AttrsOwner for TypeAliasDef {}
3663impl ast::DocCommentsOwner for TypeAliasDef {} 3801impl ast::DocCommentsOwner for TypeAliasDef {}
3664impl ast::TypeBoundsOwner for TypeAliasDef {} 3802impl ast::TypeBoundsOwner for TypeAliasDef {}
3665impl TypeAliasDef { 3803impl TypeAliasDef {
3804 pub fn default_kw(&self) -> Option<DefaultKw> {
3805 support::token(&self.syntax)
3806 }
3807 pub fn type_kw(&self) -> Option<TypeKw> {
3808 support::token(&self.syntax)
3809 }
3810 pub fn eq(&self) -> Option<Eq> {
3811 support::token(&self.syntax)
3812 }
3666 pub fn type_ref(&self) -> Option<TypeRef> { 3813 pub fn type_ref(&self) -> Option<TypeRef> {
3667 AstChildren::new(&self.syntax).next() 3814 support::child(&self.syntax)
3815 }
3816 pub fn semi(&self) -> Option<Semi> {
3817 support::token(&self.syntax)
3668 } 3818 }
3669} 3819}
3670#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3820#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3697,8 +3847,26 @@ impl AstNode for ImplDef {
3697impl ast::TypeParamsOwner for ImplDef {} 3847impl ast::TypeParamsOwner for ImplDef {}
3698impl ast::AttrsOwner for ImplDef {} 3848impl ast::AttrsOwner for ImplDef {}
3699impl ImplDef { 3849impl ImplDef {
3850 pub fn default_kw(&self) -> Option<DefaultKw> {
3851 support::token(&self.syntax)
3852 }
3853 pub fn const_kw(&self) -> Option<ConstKw> {
3854 support::token(&self.syntax)
3855 }
3856 pub fn unsafe_kw(&self) -> Option<UnsafeKw> {
3857 support::token(&self.syntax)
3858 }
3859 pub fn impl_kw(&self) -> Option<ImplKw> {
3860 support::token(&self.syntax)
3861 }
3862 pub fn excl(&self) -> Option<Excl> {
3863 support::token(&self.syntax)
3864 }
3865 pub fn for_kw(&self) -> Option<ForKw> {
3866 support::token(&self.syntax)
3867 }
3700 pub fn item_list(&self) -> Option<ItemList> { 3868 pub fn item_list(&self) -> Option<ItemList> {
3701 AstChildren::new(&self.syntax).next() 3869 support::child(&self.syntax)
3702 } 3870 }
3703} 3871}
3704#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3872#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3729,8 +3897,14 @@ impl AstNode for ParenType {
3729 } 3897 }
3730} 3898}
3731impl ParenType { 3899impl ParenType {
3900 pub fn l_paren(&self) -> Option<LParen> {
3901 support::token(&self.syntax)
3902 }
3732 pub fn type_ref(&self) -> Option<TypeRef> { 3903 pub fn type_ref(&self) -> Option<TypeRef> {
3733 AstChildren::new(&self.syntax).next() 3904 support::child(&self.syntax)
3905 }
3906 pub fn r_paren(&self) -> Option<RParen> {
3907 support::token(&self.syntax)
3734 } 3908 }
3735} 3909}
3736#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3910#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3761,8 +3935,14 @@ impl AstNode for TupleType {
3761 } 3935 }
3762} 3936}
3763impl TupleType { 3937impl TupleType {
3938 pub fn l_paren(&self) -> Option<LParen> {
3939 support::token(&self.syntax)
3940 }
3764 pub fn fields(&self) -> AstChildren<TypeRef> { 3941 pub fn fields(&self) -> AstChildren<TypeRef> {
3765 AstChildren::new(&self.syntax) 3942 support::children(&self.syntax)
3943 }
3944 pub fn r_paren(&self) -> Option<RParen> {
3945 support::token(&self.syntax)
3766 } 3946 }
3767} 3947}
3768#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3948#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3792,7 +3972,11 @@ impl AstNode for NeverType {
3792 &self.syntax 3972 &self.syntax
3793 } 3973 }
3794} 3974}
3795impl NeverType {} 3975impl NeverType {
3976 pub fn excl(&self) -> Option<Excl> {
3977 support::token(&self.syntax)
3978 }
3979}
3796#[derive(Debug, Clone, PartialEq, Eq, Hash)] 3980#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3797pub struct PathType { 3981pub struct PathType {
3798 pub(crate) syntax: SyntaxNode, 3982 pub(crate) syntax: SyntaxNode,
@@ -3822,7 +4006,7 @@ impl AstNode for PathType {
3822} 4006}
3823impl PathType { 4007impl PathType {
3824 pub fn path(&self) -> Option<Path> { 4008 pub fn path(&self) -> Option<Path> {
3825 AstChildren::new(&self.syntax).next() 4009 support::child(&self.syntax)
3826 } 4010 }
3827} 4011}
3828#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4012#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3853,8 +4037,14 @@ impl AstNode for PointerType {
3853 } 4037 }
3854} 4038}
3855impl PointerType { 4039impl PointerType {
4040 pub fn star(&self) -> Option<Star> {
4041 support::token(&self.syntax)
4042 }
4043 pub fn const_kw(&self) -> Option<ConstKw> {
4044 support::token(&self.syntax)
4045 }
3856 pub fn type_ref(&self) -> Option<TypeRef> { 4046 pub fn type_ref(&self) -> Option<TypeRef> {
3857 AstChildren::new(&self.syntax).next() 4047 support::child(&self.syntax)
3858 } 4048 }
3859} 4049}
3860#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4050#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3885,11 +4075,20 @@ impl AstNode for ArrayType {
3885 } 4075 }
3886} 4076}
3887impl ArrayType { 4077impl ArrayType {
4078 pub fn l_brack(&self) -> Option<LBrack> {
4079 support::token(&self.syntax)
4080 }
3888 pub fn type_ref(&self) -> Option<TypeRef> { 4081 pub fn type_ref(&self) -> Option<TypeRef> {
3889 AstChildren::new(&self.syntax).next() 4082 support::child(&self.syntax)
4083 }
4084 pub fn semi(&self) -> Option<Semi> {
4085 support::token(&self.syntax)
3890 } 4086 }
3891 pub fn expr(&self) -> Option<Expr> { 4087 pub fn expr(&self) -> Option<Expr> {
3892 AstChildren::new(&self.syntax).next() 4088 support::child(&self.syntax)
4089 }
4090 pub fn r_brack(&self) -> Option<RBrack> {
4091 support::token(&self.syntax)
3893 } 4092 }
3894} 4093}
3895#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4094#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3920,8 +4119,14 @@ impl AstNode for SliceType {
3920 } 4119 }
3921} 4120}
3922impl SliceType { 4121impl SliceType {
4122 pub fn l_brack(&self) -> Option<LBrack> {
4123 support::token(&self.syntax)
4124 }
3923 pub fn type_ref(&self) -> Option<TypeRef> { 4125 pub fn type_ref(&self) -> Option<TypeRef> {
3924 AstChildren::new(&self.syntax).next() 4126 support::child(&self.syntax)
4127 }
4128 pub fn r_brack(&self) -> Option<RBrack> {
4129 support::token(&self.syntax)
3925 } 4130 }
3926} 4131}
3927#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3952,8 +4157,17 @@ impl AstNode for ReferenceType {
3952 } 4157 }
3953} 4158}
3954impl ReferenceType { 4159impl ReferenceType {
4160 pub fn amp(&self) -> Option<Amp> {
4161 support::token(&self.syntax)
4162 }
4163 pub fn lifetime(&self) -> Option<Lifetime> {
4164 support::token(&self.syntax)
4165 }
4166 pub fn mut_kw(&self) -> Option<MutKw> {
4167 support::token(&self.syntax)
4168 }
3955 pub fn type_ref(&self) -> Option<TypeRef> { 4169 pub fn type_ref(&self) -> Option<TypeRef> {
3956 AstChildren::new(&self.syntax).next() 4170 support::child(&self.syntax)
3957 } 4171 }
3958} 4172}
3959#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4173#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -3983,7 +4197,11 @@ impl AstNode for PlaceholderType {
3983 &self.syntax 4197 &self.syntax
3984 } 4198 }
3985} 4199}
3986impl PlaceholderType {} 4200impl PlaceholderType {
4201 pub fn underscore(&self) -> Option<Underscore> {
4202 support::token(&self.syntax)
4203 }
4204}
3987#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4205#[derive(Debug, Clone, PartialEq, Eq, Hash)]
3988pub struct FnPointerType { 4206pub struct FnPointerType {
3989 pub(crate) syntax: SyntaxNode, 4207 pub(crate) syntax: SyntaxNode,
@@ -4012,11 +4230,20 @@ impl AstNode for FnPointerType {
4012 } 4230 }
4013} 4231}
4014impl FnPointerType { 4232impl FnPointerType {
4233 pub fn abi(&self) -> Option<Abi> {
4234 support::child(&self.syntax)
4235 }
4236 pub fn unsafe_kw(&self) -> Option<UnsafeKw> {
4237 support::token(&self.syntax)
4238 }
4239 pub fn fn_kw(&self) -> Option<FnKw> {
4240 support::token(&self.syntax)
4241 }
4015 pub fn param_list(&self) -> Option<ParamList> { 4242 pub fn param_list(&self) -> Option<ParamList> {
4016 AstChildren::new(&self.syntax).next() 4243 support::child(&self.syntax)
4017 } 4244 }
4018 pub fn ret_type(&self) -> Option<RetType> { 4245 pub fn ret_type(&self) -> Option<RetType> {
4019 AstChildren::new(&self.syntax).next() 4246 support::child(&self.syntax)
4020 } 4247 }
4021} 4248}
4022#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4249#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4047,8 +4274,14 @@ impl AstNode for ForType {
4047 } 4274 }
4048} 4275}
4049impl ForType { 4276impl ForType {
4277 pub fn for_kw(&self) -> Option<ForKw> {
4278 support::token(&self.syntax)
4279 }
4280 pub fn type_param_list(&self) -> Option<TypeParamList> {
4281 support::child(&self.syntax)
4282 }
4050 pub fn type_ref(&self) -> Option<TypeRef> { 4283 pub fn type_ref(&self) -> Option<TypeRef> {
4051 AstChildren::new(&self.syntax).next() 4284 support::child(&self.syntax)
4052 } 4285 }
4053} 4286}
4054#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4287#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4079,7 +4312,11 @@ impl AstNode for ImplTraitType {
4079 } 4312 }
4080} 4313}
4081impl ast::TypeBoundsOwner for ImplTraitType {} 4314impl ast::TypeBoundsOwner for ImplTraitType {}
4082impl ImplTraitType {} 4315impl ImplTraitType {
4316 pub fn impl_kw(&self) -> Option<ImplKw> {
4317 support::token(&self.syntax)
4318 }
4319}
4083#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4320#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4084pub struct DynTraitType { 4321pub struct DynTraitType {
4085 pub(crate) syntax: SyntaxNode, 4322 pub(crate) syntax: SyntaxNode,
@@ -4108,7 +4345,11 @@ impl AstNode for DynTraitType {
4108 } 4345 }
4109} 4346}
4110impl ast::TypeBoundsOwner for DynTraitType {} 4347impl ast::TypeBoundsOwner for DynTraitType {}
4111impl DynTraitType {} 4348impl DynTraitType {
4349 pub fn dyn_kw(&self) -> Option<DynKw> {
4350 support::token(&self.syntax)
4351 }
4352}
4112#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4353#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4113pub struct TupleExpr { 4354pub struct TupleExpr {
4114 pub(crate) syntax: SyntaxNode, 4355 pub(crate) syntax: SyntaxNode,
@@ -4136,9 +4377,16 @@ impl AstNode for TupleExpr {
4136 &self.syntax 4377 &self.syntax
4137 } 4378 }
4138} 4379}
4380impl ast::AttrsOwner for TupleExpr {}
4139impl TupleExpr { 4381impl TupleExpr {
4382 pub fn l_paren(&self) -> Option<LParen> {
4383 support::token(&self.syntax)
4384 }
4140 pub fn exprs(&self) -> AstChildren<Expr> { 4385 pub fn exprs(&self) -> AstChildren<Expr> {
4141 AstChildren::new(&self.syntax) 4386 support::children(&self.syntax)
4387 }
4388 pub fn r_paren(&self) -> Option<RParen> {
4389 support::token(&self.syntax)
4142 } 4390 }
4143} 4391}
4144#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4392#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4168,9 +4416,19 @@ impl AstNode for ArrayExpr {
4168 &self.syntax 4416 &self.syntax
4169 } 4417 }
4170} 4418}
4419impl ast::AttrsOwner for ArrayExpr {}
4171impl ArrayExpr { 4420impl ArrayExpr {
4421 pub fn l_brack(&self) -> Option<LBrack> {
4422 support::token(&self.syntax)
4423 }
4172 pub fn exprs(&self) -> AstChildren<Expr> { 4424 pub fn exprs(&self) -> AstChildren<Expr> {
4173 AstChildren::new(&self.syntax) 4425 support::children(&self.syntax)
4426 }
4427 pub fn semi(&self) -> Option<Semi> {
4428 support::token(&self.syntax)
4429 }
4430 pub fn r_brack(&self) -> Option<RBrack> {
4431 support::token(&self.syntax)
4174 } 4432 }
4175} 4433}
4176#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4434#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4200,9 +4458,16 @@ impl AstNode for ParenExpr {
4200 &self.syntax 4458 &self.syntax
4201 } 4459 }
4202} 4460}
4461impl ast::AttrsOwner for ParenExpr {}
4203impl ParenExpr { 4462impl ParenExpr {
4463 pub fn l_paren(&self) -> Option<LParen> {
4464 support::token(&self.syntax)
4465 }
4204 pub fn expr(&self) -> Option<Expr> { 4466 pub fn expr(&self) -> Option<Expr> {
4205 AstChildren::new(&self.syntax).next() 4467 support::child(&self.syntax)
4468 }
4469 pub fn r_paren(&self) -> Option<RParen> {
4470 support::token(&self.syntax)
4206 } 4471 }
4207} 4472}
4208#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4473#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4234,7 +4499,7 @@ impl AstNode for PathExpr {
4234} 4499}
4235impl PathExpr { 4500impl PathExpr {
4236 pub fn path(&self) -> Option<Path> { 4501 pub fn path(&self) -> Option<Path> {
4237 AstChildren::new(&self.syntax).next() 4502 support::child(&self.syntax)
4238 } 4503 }
4239} 4504}
4240#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4505#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4264,15 +4529,25 @@ impl AstNode for LambdaExpr {
4264 &self.syntax 4529 &self.syntax
4265 } 4530 }
4266} 4531}
4532impl ast::AttrsOwner for LambdaExpr {}
4267impl LambdaExpr { 4533impl LambdaExpr {
4534 pub fn static_kw(&self) -> Option<StaticKw> {
4535 support::token(&self.syntax)
4536 }
4537 pub fn async_kw(&self) -> Option<AsyncKw> {
4538 support::token(&self.syntax)
4539 }
4540 pub fn move_kw(&self) -> Option<MoveKw> {
4541 support::token(&self.syntax)
4542 }
4268 pub fn param_list(&self) -> Option<ParamList> { 4543 pub fn param_list(&self) -> Option<ParamList> {
4269 AstChildren::new(&self.syntax).next() 4544 support::child(&self.syntax)
4270 } 4545 }
4271 pub fn ret_type(&self) -> Option<RetType> { 4546 pub fn ret_type(&self) -> Option<RetType> {
4272 AstChildren::new(&self.syntax).next() 4547 support::child(&self.syntax)
4273 } 4548 }
4274 pub fn body(&self) -> Option<Expr> { 4549 pub fn body(&self) -> Option<Expr> {
4275 AstChildren::new(&self.syntax).next() 4550 support::child(&self.syntax)
4276 } 4551 }
4277} 4552}
4278#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4553#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4302,9 +4577,13 @@ impl AstNode for IfExpr {
4302 &self.syntax 4577 &self.syntax
4303 } 4578 }
4304} 4579}
4580impl ast::AttrsOwner for IfExpr {}
4305impl IfExpr { 4581impl IfExpr {
4582 pub fn if_kw(&self) -> Option<IfKw> {
4583 support::token(&self.syntax)
4584 }
4306 pub fn condition(&self) -> Option<Condition> { 4585 pub fn condition(&self) -> Option<Condition> {
4307 AstChildren::new(&self.syntax).next() 4586 support::child(&self.syntax)
4308 } 4587 }
4309} 4588}
4310#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4589#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4334,8 +4613,13 @@ impl AstNode for LoopExpr {
4334 &self.syntax 4613 &self.syntax
4335 } 4614 }
4336} 4615}
4616impl ast::AttrsOwner for LoopExpr {}
4337impl ast::LoopBodyOwner for LoopExpr {} 4617impl ast::LoopBodyOwner for LoopExpr {}
4338impl LoopExpr {} 4618impl LoopExpr {
4619 pub fn loop_kw(&self) -> Option<LoopKw> {
4620 support::token(&self.syntax)
4621 }
4622}
4339#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4623#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4340pub struct TryBlockExpr { 4624pub struct TryBlockExpr {
4341 pub(crate) syntax: SyntaxNode, 4625 pub(crate) syntax: SyntaxNode,
@@ -4363,9 +4647,13 @@ impl AstNode for TryBlockExpr {
4363 &self.syntax 4647 &self.syntax
4364 } 4648 }
4365} 4649}
4650impl ast::AttrsOwner for TryBlockExpr {}
4366impl TryBlockExpr { 4651impl TryBlockExpr {
4652 pub fn try_kw(&self) -> Option<TryKw> {
4653 support::token(&self.syntax)
4654 }
4367 pub fn body(&self) -> Option<BlockExpr> { 4655 pub fn body(&self) -> Option<BlockExpr> {
4368 AstChildren::new(&self.syntax).next() 4656 support::child(&self.syntax)
4369 } 4657 }
4370} 4658}
4371#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4659#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4395,13 +4683,20 @@ impl AstNode for ForExpr {
4395 &self.syntax 4683 &self.syntax
4396 } 4684 }
4397} 4685}
4686impl ast::AttrsOwner for ForExpr {}
4398impl ast::LoopBodyOwner for ForExpr {} 4687impl ast::LoopBodyOwner for ForExpr {}
4399impl ForExpr { 4688impl ForExpr {
4689 pub fn for_kw(&self) -> Option<ForKw> {
4690 support::token(&self.syntax)
4691 }
4400 pub fn pat(&self) -> Option<Pat> { 4692 pub fn pat(&self) -> Option<Pat> {
4401 AstChildren::new(&self.syntax).next() 4693 support::child(&self.syntax)
4694 }
4695 pub fn in_kw(&self) -> Option<InKw> {
4696 support::token(&self.syntax)
4402 } 4697 }
4403 pub fn iterable(&self) -> Option<Expr> { 4698 pub fn iterable(&self) -> Option<Expr> {
4404 AstChildren::new(&self.syntax).next() 4699 support::child(&self.syntax)
4405 } 4700 }
4406} 4701}
4407#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4702#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4431,10 +4726,14 @@ impl AstNode for WhileExpr {
4431 &self.syntax 4726 &self.syntax
4432 } 4727 }
4433} 4728}
4729impl ast::AttrsOwner for WhileExpr {}
4434impl ast::LoopBodyOwner for WhileExpr {} 4730impl ast::LoopBodyOwner for WhileExpr {}
4435impl WhileExpr { 4731impl WhileExpr {
4732 pub fn while_kw(&self) -> Option<WhileKw> {
4733 support::token(&self.syntax)
4734 }
4436 pub fn condition(&self) -> Option<Condition> { 4735 pub fn condition(&self) -> Option<Condition> {
4437 AstChildren::new(&self.syntax).next() 4736 support::child(&self.syntax)
4438 } 4737 }
4439} 4738}
4440#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4739#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4464,7 +4763,15 @@ impl AstNode for ContinueExpr {
4464 &self.syntax 4763 &self.syntax
4465 } 4764 }
4466} 4765}
4467impl ContinueExpr {} 4766impl ast::AttrsOwner for ContinueExpr {}
4767impl ContinueExpr {
4768 pub fn continue_kw(&self) -> Option<ContinueKw> {
4769 support::token(&self.syntax)
4770 }
4771 pub fn lifetime(&self) -> Option<Lifetime> {
4772 support::token(&self.syntax)
4773 }
4774}
4468#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4775#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4469pub struct BreakExpr { 4776pub struct BreakExpr {
4470 pub(crate) syntax: SyntaxNode, 4777 pub(crate) syntax: SyntaxNode,
@@ -4492,9 +4799,16 @@ impl AstNode for BreakExpr {
4492 &self.syntax 4799 &self.syntax
4493 } 4800 }
4494} 4801}
4802impl ast::AttrsOwner for BreakExpr {}
4495impl BreakExpr { 4803impl BreakExpr {
4804 pub fn break_kw(&self) -> Option<BreakKw> {
4805 support::token(&self.syntax)
4806 }
4807 pub fn lifetime(&self) -> Option<Lifetime> {
4808 support::token(&self.syntax)
4809 }
4496 pub fn expr(&self) -> Option<Expr> { 4810 pub fn expr(&self) -> Option<Expr> {
4497 AstChildren::new(&self.syntax).next() 4811 support::child(&self.syntax)
4498 } 4812 }
4499} 4813}
4500#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4814#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4524,7 +4838,11 @@ impl AstNode for Label {
4524 &self.syntax 4838 &self.syntax
4525 } 4839 }
4526} 4840}
4527impl Label {} 4841impl Label {
4842 pub fn lifetime(&self) -> Option<Lifetime> {
4843 support::token(&self.syntax)
4844 }
4845}
4528#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4846#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4529pub struct BlockExpr { 4847pub struct BlockExpr {
4530 pub(crate) syntax: SyntaxNode, 4848 pub(crate) syntax: SyntaxNode,
@@ -4552,9 +4870,16 @@ impl AstNode for BlockExpr {
4552 &self.syntax 4870 &self.syntax
4553 } 4871 }
4554} 4872}
4873impl ast::AttrsOwner for BlockExpr {}
4555impl BlockExpr { 4874impl BlockExpr {
4875 pub fn label(&self) -> Option<Label> {
4876 support::child(&self.syntax)
4877 }
4878 pub fn unsafe_kw(&self) -> Option<UnsafeKw> {
4879 support::token(&self.syntax)
4880 }
4556 pub fn block(&self) -> Option<Block> { 4881 pub fn block(&self) -> Option<Block> {
4557 AstChildren::new(&self.syntax).next() 4882 support::child(&self.syntax)
4558 } 4883 }
4559} 4884}
4560#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4885#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4584,9 +4909,10 @@ impl AstNode for ReturnExpr {
4584 &self.syntax 4909 &self.syntax
4585 } 4910 }
4586} 4911}
4912impl ast::AttrsOwner for ReturnExpr {}
4587impl ReturnExpr { 4913impl ReturnExpr {
4588 pub fn expr(&self) -> Option<Expr> { 4914 pub fn expr(&self) -> Option<Expr> {
4589 AstChildren::new(&self.syntax).next() 4915 support::child(&self.syntax)
4590 } 4916 }
4591} 4917}
4592#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4918#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4619,7 +4945,7 @@ impl AstNode for CallExpr {
4619impl ast::ArgListOwner for CallExpr {} 4945impl ast::ArgListOwner for CallExpr {}
4620impl CallExpr { 4946impl CallExpr {
4621 pub fn expr(&self) -> Option<Expr> { 4947 pub fn expr(&self) -> Option<Expr> {
4622 AstChildren::new(&self.syntax).next() 4948 support::child(&self.syntax)
4623 } 4949 }
4624} 4950}
4625#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4951#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4649,16 +4975,20 @@ impl AstNode for MethodCallExpr {
4649 &self.syntax 4975 &self.syntax
4650 } 4976 }
4651} 4977}
4978impl ast::AttrsOwner for MethodCallExpr {}
4652impl ast::ArgListOwner for MethodCallExpr {} 4979impl ast::ArgListOwner for MethodCallExpr {}
4653impl MethodCallExpr { 4980impl MethodCallExpr {
4654 pub fn expr(&self) -> Option<Expr> { 4981 pub fn expr(&self) -> Option<Expr> {
4655 AstChildren::new(&self.syntax).next() 4982 support::child(&self.syntax)
4983 }
4984 pub fn dot(&self) -> Option<Dot> {
4985 support::token(&self.syntax)
4656 } 4986 }
4657 pub fn name_ref(&self) -> Option<NameRef> { 4987 pub fn name_ref(&self) -> Option<NameRef> {
4658 AstChildren::new(&self.syntax).next() 4988 support::child(&self.syntax)
4659 } 4989 }
4660 pub fn type_arg_list(&self) -> Option<TypeArgList> { 4990 pub fn type_arg_list(&self) -> Option<TypeArgList> {
4661 AstChildren::new(&self.syntax).next() 4991 support::child(&self.syntax)
4662 } 4992 }
4663} 4993}
4664#[derive(Debug, Clone, PartialEq, Eq, Hash)] 4994#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4688,7 +5018,15 @@ impl AstNode for IndexExpr {
4688 &self.syntax 5018 &self.syntax
4689 } 5019 }
4690} 5020}
4691impl IndexExpr {} 5021impl ast::AttrsOwner for IndexExpr {}
5022impl IndexExpr {
5023 pub fn l_brack(&self) -> Option<LBrack> {
5024 support::token(&self.syntax)
5025 }
5026 pub fn r_brack(&self) -> Option<RBrack> {
5027 support::token(&self.syntax)
5028 }
5029}
4692#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5030#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4693pub struct FieldExpr { 5031pub struct FieldExpr {
4694 pub(crate) syntax: SyntaxNode, 5032 pub(crate) syntax: SyntaxNode,
@@ -4716,12 +5054,16 @@ impl AstNode for FieldExpr {
4716 &self.syntax 5054 &self.syntax
4717 } 5055 }
4718} 5056}
5057impl ast::AttrsOwner for FieldExpr {}
4719impl FieldExpr { 5058impl FieldExpr {
4720 pub fn expr(&self) -> Option<Expr> { 5059 pub fn expr(&self) -> Option<Expr> {
4721 AstChildren::new(&self.syntax).next() 5060 support::child(&self.syntax)
5061 }
5062 pub fn dot(&self) -> Option<Dot> {
5063 support::token(&self.syntax)
4722 } 5064 }
4723 pub fn name_ref(&self) -> Option<NameRef> { 5065 pub fn name_ref(&self) -> Option<NameRef> {
4724 AstChildren::new(&self.syntax).next() 5066 support::child(&self.syntax)
4725 } 5067 }
4726} 5068}
4727#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5069#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4751,9 +5093,16 @@ impl AstNode for AwaitExpr {
4751 &self.syntax 5093 &self.syntax
4752 } 5094 }
4753} 5095}
5096impl ast::AttrsOwner for AwaitExpr {}
4754impl AwaitExpr { 5097impl AwaitExpr {
4755 pub fn expr(&self) -> Option<Expr> { 5098 pub fn expr(&self) -> Option<Expr> {
4756 AstChildren::new(&self.syntax).next() 5099 support::child(&self.syntax)
5100 }
5101 pub fn dot(&self) -> Option<Dot> {
5102 support::token(&self.syntax)
5103 }
5104 pub fn await_kw(&self) -> Option<AwaitKw> {
5105 support::token(&self.syntax)
4757 } 5106 }
4758} 5107}
4759#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5108#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4783,9 +5132,13 @@ impl AstNode for TryExpr {
4783 &self.syntax 5132 &self.syntax
4784 } 5133 }
4785} 5134}
5135impl ast::AttrsOwner for TryExpr {}
4786impl TryExpr { 5136impl TryExpr {
5137 pub fn try_kw(&self) -> Option<TryKw> {
5138 support::token(&self.syntax)
5139 }
4787 pub fn expr(&self) -> Option<Expr> { 5140 pub fn expr(&self) -> Option<Expr> {
4788 AstChildren::new(&self.syntax).next() 5141 support::child(&self.syntax)
4789 } 5142 }
4790} 5143}
4791#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5144#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4815,12 +5168,16 @@ impl AstNode for CastExpr {
4815 &self.syntax 5168 &self.syntax
4816 } 5169 }
4817} 5170}
5171impl ast::AttrsOwner for CastExpr {}
4818impl CastExpr { 5172impl CastExpr {
4819 pub fn expr(&self) -> Option<Expr> { 5173 pub fn expr(&self) -> Option<Expr> {
4820 AstChildren::new(&self.syntax).next() 5174 support::child(&self.syntax)
5175 }
5176 pub fn as_kw(&self) -> Option<AsKw> {
5177 support::token(&self.syntax)
4821 } 5178 }
4822 pub fn type_ref(&self) -> Option<TypeRef> { 5179 pub fn type_ref(&self) -> Option<TypeRef> {
4823 AstChildren::new(&self.syntax).next() 5180 support::child(&self.syntax)
4824 } 5181 }
4825} 5182}
4826#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5183#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4850,9 +5207,19 @@ impl AstNode for RefExpr {
4850 &self.syntax 5207 &self.syntax
4851 } 5208 }
4852} 5209}
5210impl ast::AttrsOwner for RefExpr {}
4853impl RefExpr { 5211impl RefExpr {
5212 pub fn amp(&self) -> Option<Amp> {
5213 support::token(&self.syntax)
5214 }
5215 pub fn raw_kw(&self) -> Option<RawKw> {
5216 support::token(&self.syntax)
5217 }
5218 pub fn mut_kw(&self) -> Option<MutKw> {
5219 support::token(&self.syntax)
5220 }
4854 pub fn expr(&self) -> Option<Expr> { 5221 pub fn expr(&self) -> Option<Expr> {
4855 AstChildren::new(&self.syntax).next() 5222 support::child(&self.syntax)
4856 } 5223 }
4857} 5224}
4858#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5225#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4882,9 +5249,13 @@ impl AstNode for PrefixExpr {
4882 &self.syntax 5249 &self.syntax
4883 } 5250 }
4884} 5251}
5252impl ast::AttrsOwner for PrefixExpr {}
4885impl PrefixExpr { 5253impl PrefixExpr {
5254 pub fn prefix_op(&self) -> Option<PrefixOp> {
5255 support::token(&self.syntax)
5256 }
4886 pub fn expr(&self) -> Option<Expr> { 5257 pub fn expr(&self) -> Option<Expr> {
4887 AstChildren::new(&self.syntax).next() 5258 support::child(&self.syntax)
4888 } 5259 }
4889} 5260}
4890#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5261#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4914,9 +5285,13 @@ impl AstNode for BoxExpr {
4914 &self.syntax 5285 &self.syntax
4915 } 5286 }
4916} 5287}
5288impl ast::AttrsOwner for BoxExpr {}
4917impl BoxExpr { 5289impl BoxExpr {
5290 pub fn box_kw(&self) -> Option<BoxKw> {
5291 support::token(&self.syntax)
5292 }
4918 pub fn expr(&self) -> Option<Expr> { 5293 pub fn expr(&self) -> Option<Expr> {
4919 AstChildren::new(&self.syntax).next() 5294 support::child(&self.syntax)
4920 } 5295 }
4921} 5296}
4922#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5297#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -4946,7 +5321,12 @@ impl AstNode for RangeExpr {
4946 &self.syntax 5321 &self.syntax
4947 } 5322 }
4948} 5323}
4949impl RangeExpr {} 5324impl ast::AttrsOwner for RangeExpr {}
5325impl RangeExpr {
5326 pub fn range_op(&self) -> Option<RangeOp> {
5327 support::token(&self.syntax)
5328 }
5329}
4950#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4951pub struct BinExpr { 5331pub struct BinExpr {
4952 pub(crate) syntax: SyntaxNode, 5332 pub(crate) syntax: SyntaxNode,
@@ -4974,7 +5354,12 @@ impl AstNode for BinExpr {
4974 &self.syntax 5354 &self.syntax
4975 } 5355 }
4976} 5356}
4977impl BinExpr {} 5357impl ast::AttrsOwner for BinExpr {}
5358impl BinExpr {
5359 pub fn bin_op(&self) -> Option<BinOp> {
5360 support::token(&self.syntax)
5361 }
5362}
4978#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5363#[derive(Debug, Clone, PartialEq, Eq, Hash)]
4979pub struct Literal { 5364pub struct Literal {
4980 pub(crate) syntax: SyntaxNode, 5365 pub(crate) syntax: SyntaxNode,
@@ -5002,7 +5387,11 @@ impl AstNode for Literal {
5002 &self.syntax 5387 &self.syntax
5003 } 5388 }
5004} 5389}
5005impl Literal {} 5390impl Literal {
5391 pub fn literal_token(&self) -> Option<LiteralToken> {
5392 support::token(&self.syntax)
5393 }
5394}
5006#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5395#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5007pub struct MatchExpr { 5396pub struct MatchExpr {
5008 pub(crate) syntax: SyntaxNode, 5397 pub(crate) syntax: SyntaxNode,
@@ -5030,12 +5419,16 @@ impl AstNode for MatchExpr {
5030 &self.syntax 5419 &self.syntax
5031 } 5420 }
5032} 5421}
5422impl ast::AttrsOwner for MatchExpr {}
5033impl MatchExpr { 5423impl MatchExpr {
5424 pub fn match_kw(&self) -> Option<MatchKw> {
5425 support::token(&self.syntax)
5426 }
5034 pub fn expr(&self) -> Option<Expr> { 5427 pub fn expr(&self) -> Option<Expr> {
5035 AstChildren::new(&self.syntax).next() 5428 support::child(&self.syntax)
5036 } 5429 }
5037 pub fn match_arm_list(&self) -> Option<MatchArmList> { 5430 pub fn match_arm_list(&self) -> Option<MatchArmList> {
5038 AstChildren::new(&self.syntax).next() 5431 support::child(&self.syntax)
5039 } 5432 }
5040} 5433}
5041#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5434#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5067,8 +5460,14 @@ impl AstNode for MatchArmList {
5067} 5460}
5068impl ast::AttrsOwner for MatchArmList {} 5461impl ast::AttrsOwner for MatchArmList {}
5069impl MatchArmList { 5462impl MatchArmList {
5463 pub fn l_curly(&self) -> Option<LCurly> {
5464 support::token(&self.syntax)
5465 }
5070 pub fn arms(&self) -> AstChildren<MatchArm> { 5466 pub fn arms(&self) -> AstChildren<MatchArm> {
5071 AstChildren::new(&self.syntax) 5467 support::children(&self.syntax)
5468 }
5469 pub fn r_curly(&self) -> Option<RCurly> {
5470 support::token(&self.syntax)
5072 } 5471 }
5073} 5472}
5074#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5473#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5101,13 +5500,16 @@ impl AstNode for MatchArm {
5101impl ast::AttrsOwner for MatchArm {} 5500impl ast::AttrsOwner for MatchArm {}
5102impl MatchArm { 5501impl MatchArm {
5103 pub fn pat(&self) -> Option<Pat> { 5502 pub fn pat(&self) -> Option<Pat> {
5104 AstChildren::new(&self.syntax).next() 5503 support::child(&self.syntax)
5105 } 5504 }
5106 pub fn guard(&self) -> Option<MatchGuard> { 5505 pub fn guard(&self) -> Option<MatchGuard> {
5107 AstChildren::new(&self.syntax).next() 5506 support::child(&self.syntax)
5507 }
5508 pub fn fat_arrow(&self) -> Option<FatArrow> {
5509 support::token(&self.syntax)
5108 } 5510 }
5109 pub fn expr(&self) -> Option<Expr> { 5511 pub fn expr(&self) -> Option<Expr> {
5110 AstChildren::new(&self.syntax).next() 5512 support::child(&self.syntax)
5111 } 5513 }
5112} 5514}
5113#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5515#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5138,8 +5540,11 @@ impl AstNode for MatchGuard {
5138 } 5540 }
5139} 5541}
5140impl MatchGuard { 5542impl MatchGuard {
5543 pub fn if_kw(&self) -> Option<IfKw> {
5544 support::token(&self.syntax)
5545 }
5141 pub fn expr(&self) -> Option<Expr> { 5546 pub fn expr(&self) -> Option<Expr> {
5142 AstChildren::new(&self.syntax).next() 5547 support::child(&self.syntax)
5143 } 5548 }
5144} 5549}
5145#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5550#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5171,10 +5576,10 @@ impl AstNode for RecordLit {
5171} 5576}
5172impl RecordLit { 5577impl RecordLit {
5173 pub fn path(&self) -> Option<Path> { 5578 pub fn path(&self) -> Option<Path> {
5174 AstChildren::new(&self.syntax).next() 5579 support::child(&self.syntax)
5175 } 5580 }
5176 pub fn record_field_list(&self) -> Option<RecordFieldList> { 5581 pub fn record_field_list(&self) -> Option<RecordFieldList> {
5177 AstChildren::new(&self.syntax).next() 5582 support::child(&self.syntax)
5178 } 5583 }
5179} 5584}
5180#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5585#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5205,11 +5610,20 @@ impl AstNode for RecordFieldList {
5205 } 5610 }
5206} 5611}
5207impl RecordFieldList { 5612impl RecordFieldList {
5613 pub fn l_curly(&self) -> Option<LCurly> {
5614 support::token(&self.syntax)
5615 }
5208 pub fn fields(&self) -> AstChildren<RecordField> { 5616 pub fn fields(&self) -> AstChildren<RecordField> {
5209 AstChildren::new(&self.syntax) 5617 support::children(&self.syntax)
5618 }
5619 pub fn dotdot(&self) -> Option<Dotdot> {
5620 support::token(&self.syntax)
5210 } 5621 }
5211 pub fn spread(&self) -> Option<Expr> { 5622 pub fn spread(&self) -> Option<Expr> {
5212 AstChildren::new(&self.syntax).next() 5623 support::child(&self.syntax)
5624 }
5625 pub fn r_curly(&self) -> Option<RCurly> {
5626 support::token(&self.syntax)
5213 } 5627 }
5214} 5628}
5215#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5239,12 +5653,16 @@ impl AstNode for RecordField {
5239 &self.syntax 5653 &self.syntax
5240 } 5654 }
5241} 5655}
5656impl ast::AttrsOwner for RecordField {}
5242impl RecordField { 5657impl RecordField {
5243 pub fn name_ref(&self) -> Option<NameRef> { 5658 pub fn name_ref(&self) -> Option<NameRef> {
5244 AstChildren::new(&self.syntax).next() 5659 support::child(&self.syntax)
5660 }
5661 pub fn colon(&self) -> Option<Colon> {
5662 support::token(&self.syntax)
5245 } 5663 }
5246 pub fn expr(&self) -> Option<Expr> { 5664 pub fn expr(&self) -> Option<Expr> {
5247 AstChildren::new(&self.syntax).next() 5665 support::child(&self.syntax)
5248 } 5666 }
5249} 5667}
5250#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5668#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5276,7 +5694,7 @@ impl AstNode for OrPat {
5276} 5694}
5277impl OrPat { 5695impl OrPat {
5278 pub fn pats(&self) -> AstChildren<Pat> { 5696 pub fn pats(&self) -> AstChildren<Pat> {
5279 AstChildren::new(&self.syntax) 5697 support::children(&self.syntax)
5280 } 5698 }
5281} 5699}
5282#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5700#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5307,8 +5725,14 @@ impl AstNode for ParenPat {
5307 } 5725 }
5308} 5726}
5309impl ParenPat { 5727impl ParenPat {
5728 pub fn l_paren(&self) -> Option<LParen> {
5729 support::token(&self.syntax)
5730 }
5310 pub fn pat(&self) -> Option<Pat> { 5731 pub fn pat(&self) -> Option<Pat> {
5311 AstChildren::new(&self.syntax).next() 5732 support::child(&self.syntax)
5733 }
5734 pub fn r_paren(&self) -> Option<RParen> {
5735 support::token(&self.syntax)
5312 } 5736 }
5313} 5737}
5314#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5738#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5339,8 +5763,14 @@ impl AstNode for RefPat {
5339 } 5763 }
5340} 5764}
5341impl RefPat { 5765impl RefPat {
5766 pub fn amp(&self) -> Option<Amp> {
5767 support::token(&self.syntax)
5768 }
5769 pub fn mut_kw(&self) -> Option<MutKw> {
5770 support::token(&self.syntax)
5771 }
5342 pub fn pat(&self) -> Option<Pat> { 5772 pub fn pat(&self) -> Option<Pat> {
5343 AstChildren::new(&self.syntax).next() 5773 support::child(&self.syntax)
5344 } 5774 }
5345} 5775}
5346#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5776#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5371,8 +5801,11 @@ impl AstNode for BoxPat {
5371 } 5801 }
5372} 5802}
5373impl BoxPat { 5803impl BoxPat {
5804 pub fn box_kw(&self) -> Option<BoxKw> {
5805 support::token(&self.syntax)
5806 }
5374 pub fn pat(&self) -> Option<Pat> { 5807 pub fn pat(&self) -> Option<Pat> {
5375 AstChildren::new(&self.syntax).next() 5808 support::child(&self.syntax)
5376 } 5809 }
5377} 5810}
5378#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5811#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5402,10 +5835,17 @@ impl AstNode for BindPat {
5402 &self.syntax 5835 &self.syntax
5403 } 5836 }
5404} 5837}
5838impl ast::AttrsOwner for BindPat {}
5405impl ast::NameOwner for BindPat {} 5839impl ast::NameOwner for BindPat {}
5406impl BindPat { 5840impl BindPat {
5841 pub fn ref_kw(&self) -> Option<RefKw> {
5842 support::token(&self.syntax)
5843 }
5844 pub fn mut_kw(&self) -> Option<MutKw> {
5845 support::token(&self.syntax)
5846 }
5407 pub fn pat(&self) -> Option<Pat> { 5847 pub fn pat(&self) -> Option<Pat> {
5408 AstChildren::new(&self.syntax).next() 5848 support::child(&self.syntax)
5409 } 5849 }
5410} 5850}
5411#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5851#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5435,7 +5875,11 @@ impl AstNode for PlaceholderPat {
5435 &self.syntax 5875 &self.syntax
5436 } 5876 }
5437} 5877}
5438impl PlaceholderPat {} 5878impl PlaceholderPat {
5879 pub fn underscore(&self) -> Option<Underscore> {
5880 support::token(&self.syntax)
5881 }
5882}
5439#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5883#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5440pub struct DotDotPat { 5884pub struct DotDotPat {
5441 pub(crate) syntax: SyntaxNode, 5885 pub(crate) syntax: SyntaxNode,
@@ -5463,7 +5907,11 @@ impl AstNode for DotDotPat {
5463 &self.syntax 5907 &self.syntax
5464 } 5908 }
5465} 5909}
5466impl DotDotPat {} 5910impl DotDotPat {
5911 pub fn dotdot(&self) -> Option<Dotdot> {
5912 support::token(&self.syntax)
5913 }
5914}
5467#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5915#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5468pub struct PathPat { 5916pub struct PathPat {
5469 pub(crate) syntax: SyntaxNode, 5917 pub(crate) syntax: SyntaxNode,
@@ -5493,7 +5941,7 @@ impl AstNode for PathPat {
5493} 5941}
5494impl PathPat { 5942impl PathPat {
5495 pub fn path(&self) -> Option<Path> { 5943 pub fn path(&self) -> Option<Path> {
5496 AstChildren::new(&self.syntax).next() 5944 support::child(&self.syntax)
5497 } 5945 }
5498} 5946}
5499#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5947#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5524,8 +5972,14 @@ impl AstNode for SlicePat {
5524 } 5972 }
5525} 5973}
5526impl SlicePat { 5974impl SlicePat {
5975 pub fn l_brack(&self) -> Option<LBrack> {
5976 support::token(&self.syntax)
5977 }
5527 pub fn args(&self) -> AstChildren<Pat> { 5978 pub fn args(&self) -> AstChildren<Pat> {
5528 AstChildren::new(&self.syntax) 5979 support::children(&self.syntax)
5980 }
5981 pub fn r_brack(&self) -> Option<RBrack> {
5982 support::token(&self.syntax)
5529 } 5983 }
5530} 5984}
5531#[derive(Debug, Clone, PartialEq, Eq, Hash)] 5985#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5555,7 +6009,11 @@ impl AstNode for RangePat {
5555 &self.syntax 6009 &self.syntax
5556 } 6010 }
5557} 6011}
5558impl RangePat {} 6012impl RangePat {
6013 pub fn range_separator(&self) -> Option<RangeSeparator> {
6014 support::token(&self.syntax)
6015 }
6016}
5559#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6017#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5560pub struct LiteralPat { 6018pub struct LiteralPat {
5561 pub(crate) syntax: SyntaxNode, 6019 pub(crate) syntax: SyntaxNode,
@@ -5585,7 +6043,7 @@ impl AstNode for LiteralPat {
5585} 6043}
5586impl LiteralPat { 6044impl LiteralPat {
5587 pub fn literal(&self) -> Option<Literal> { 6045 pub fn literal(&self) -> Option<Literal> {
5588 AstChildren::new(&self.syntax).next() 6046 support::child(&self.syntax)
5589 } 6047 }
5590} 6048}
5591#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6049#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5617,7 +6075,7 @@ impl AstNode for MacroPat {
5617} 6075}
5618impl MacroPat { 6076impl MacroPat {
5619 pub fn macro_call(&self) -> Option<MacroCall> { 6077 pub fn macro_call(&self) -> Option<MacroCall> {
5620 AstChildren::new(&self.syntax).next() 6078 support::child(&self.syntax)
5621 } 6079 }
5622} 6080}
5623#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6081#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5649,10 +6107,10 @@ impl AstNode for RecordPat {
5649} 6107}
5650impl RecordPat { 6108impl RecordPat {
5651 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { 6109 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
5652 AstChildren::new(&self.syntax).next() 6110 support::child(&self.syntax)
5653 } 6111 }
5654 pub fn path(&self) -> Option<Path> { 6112 pub fn path(&self) -> Option<Path> {
5655 AstChildren::new(&self.syntax).next() 6113 support::child(&self.syntax)
5656 } 6114 }
5657} 6115}
5658#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6116#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5683,11 +6141,23 @@ impl AstNode for RecordFieldPatList {
5683 } 6141 }
5684} 6142}
5685impl RecordFieldPatList { 6143impl RecordFieldPatList {
6144 pub fn l_curly(&self) -> Option<LCurly> {
6145 support::token(&self.syntax)
6146 }
6147 pub fn pats(&self) -> AstChildren<RecordInnerPat> {
6148 support::children(&self.syntax)
6149 }
5686 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { 6150 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
5687 AstChildren::new(&self.syntax) 6151 support::children(&self.syntax)
5688 } 6152 }
5689 pub fn bind_pats(&self) -> AstChildren<BindPat> { 6153 pub fn bind_pats(&self) -> AstChildren<BindPat> {
5690 AstChildren::new(&self.syntax) 6154 support::children(&self.syntax)
6155 }
6156 pub fn dotdot(&self) -> Option<Dotdot> {
6157 support::token(&self.syntax)
6158 }
6159 pub fn r_curly(&self) -> Option<RCurly> {
6160 support::token(&self.syntax)
5691 } 6161 }
5692} 6162}
5693#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6163#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5717,10 +6187,14 @@ impl AstNode for RecordFieldPat {
5717 &self.syntax 6187 &self.syntax
5718 } 6188 }
5719} 6189}
6190impl ast::AttrsOwner for RecordFieldPat {}
5720impl ast::NameOwner for RecordFieldPat {} 6191impl ast::NameOwner for RecordFieldPat {}
5721impl RecordFieldPat { 6192impl RecordFieldPat {
6193 pub fn colon(&self) -> Option<Colon> {
6194 support::token(&self.syntax)
6195 }
5722 pub fn pat(&self) -> Option<Pat> { 6196 pub fn pat(&self) -> Option<Pat> {
5723 AstChildren::new(&self.syntax).next() 6197 support::child(&self.syntax)
5724 } 6198 }
5725} 6199}
5726#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6200#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5752,10 +6226,16 @@ impl AstNode for TupleStructPat {
5752} 6226}
5753impl TupleStructPat { 6227impl TupleStructPat {
5754 pub fn path(&self) -> Option<Path> { 6228 pub fn path(&self) -> Option<Path> {
5755 AstChildren::new(&self.syntax).next() 6229 support::child(&self.syntax)
6230 }
6231 pub fn l_paren(&self) -> Option<LParen> {
6232 support::token(&self.syntax)
5756 } 6233 }
5757 pub fn args(&self) -> AstChildren<Pat> { 6234 pub fn args(&self) -> AstChildren<Pat> {
5758 AstChildren::new(&self.syntax) 6235 support::children(&self.syntax)
6236 }
6237 pub fn r_paren(&self) -> Option<RParen> {
6238 support::token(&self.syntax)
5759 } 6239 }
5760} 6240}
5761#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6241#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5786,8 +6266,14 @@ impl AstNode for TuplePat {
5786 } 6266 }
5787} 6267}
5788impl TuplePat { 6268impl TuplePat {
6269 pub fn l_paren(&self) -> Option<LParen> {
6270 support::token(&self.syntax)
6271 }
5789 pub fn args(&self) -> AstChildren<Pat> { 6272 pub fn args(&self) -> AstChildren<Pat> {
5790 AstChildren::new(&self.syntax) 6273 support::children(&self.syntax)
6274 }
6275 pub fn r_paren(&self) -> Option<RParen> {
6276 support::token(&self.syntax)
5791 } 6277 }
5792} 6278}
5793#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6279#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5817,7 +6303,20 @@ impl AstNode for Visibility {
5817 &self.syntax 6303 &self.syntax
5818 } 6304 }
5819} 6305}
5820impl Visibility {} 6306impl Visibility {
6307 pub fn pub_kw(&self) -> Option<PubKw> {
6308 support::token(&self.syntax)
6309 }
6310 pub fn super_kw(&self) -> Option<SuperKw> {
6311 support::token(&self.syntax)
6312 }
6313 pub fn self_kw(&self) -> Option<SelfKw> {
6314 support::token(&self.syntax)
6315 }
6316 pub fn crate_kw(&self) -> Option<CrateKw> {
6317 support::token(&self.syntax)
6318 }
6319}
5821#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6320#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5822pub struct Name { 6321pub struct Name {
5823 pub(crate) syntax: SyntaxNode, 6322 pub(crate) syntax: SyntaxNode,
@@ -5845,7 +6344,11 @@ impl AstNode for Name {
5845 &self.syntax 6344 &self.syntax
5846 } 6345 }
5847} 6346}
5848impl Name {} 6347impl Name {
6348 pub fn ident(&self) -> Option<Ident> {
6349 support::token(&self.syntax)
6350 }
6351}
5849#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6352#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5850pub struct NameRef { 6353pub struct NameRef {
5851 pub(crate) syntax: SyntaxNode, 6354 pub(crate) syntax: SyntaxNode,
@@ -5873,7 +6376,11 @@ impl AstNode for NameRef {
5873 &self.syntax 6376 &self.syntax
5874 } 6377 }
5875} 6378}
5876impl NameRef {} 6379impl NameRef {
6380 pub fn name_ref_token(&self) -> Option<NameRefToken> {
6381 support::token(&self.syntax)
6382 }
6383}
5877#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6384#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5878pub struct MacroCall { 6385pub struct MacroCall {
5879 pub(crate) syntax: SyntaxNode, 6386 pub(crate) syntax: SyntaxNode,
@@ -5905,11 +6412,17 @@ impl ast::NameOwner for MacroCall {}
5905impl ast::AttrsOwner for MacroCall {} 6412impl ast::AttrsOwner for MacroCall {}
5906impl ast::DocCommentsOwner for MacroCall {} 6413impl ast::DocCommentsOwner for MacroCall {}
5907impl MacroCall { 6414impl MacroCall {
6415 pub fn path(&self) -> Option<Path> {
6416 support::child(&self.syntax)
6417 }
6418 pub fn excl(&self) -> Option<Excl> {
6419 support::token(&self.syntax)
6420 }
5908 pub fn token_tree(&self) -> Option<TokenTree> { 6421 pub fn token_tree(&self) -> Option<TokenTree> {
5909 AstChildren::new(&self.syntax).next() 6422 support::child(&self.syntax)
5910 } 6423 }
5911 pub fn path(&self) -> Option<Path> { 6424 pub fn semi(&self) -> Option<Semi> {
5912 AstChildren::new(&self.syntax).next() 6425 support::token(&self.syntax)
5913 } 6426 }
5914} 6427}
5915#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6428#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -5940,11 +6453,26 @@ impl AstNode for Attr {
5940 } 6453 }
5941} 6454}
5942impl Attr { 6455impl Attr {
6456 pub fn pound(&self) -> Option<Pound> {
6457 support::token(&self.syntax)
6458 }
6459 pub fn excl(&self) -> Option<Excl> {
6460 support::token(&self.syntax)
6461 }
6462 pub fn l_brack(&self) -> Option<LBrack> {
6463 support::token(&self.syntax)
6464 }
5943 pub fn path(&self) -> Option<Path> { 6465 pub fn path(&self) -> Option<Path> {
5944 AstChildren::new(&self.syntax).next() 6466 support::child(&self.syntax)
6467 }
6468 pub fn eq(&self) -> Option<Eq> {
6469 support::token(&self.syntax)
5945 } 6470 }
5946 pub fn input(&self) -> Option<AttrInput> { 6471 pub fn input(&self) -> Option<AttrInput> {
5947 AstChildren::new(&self.syntax).next() 6472 support::child(&self.syntax)
6473 }
6474 pub fn r_brack(&self) -> Option<RBrack> {
6475 support::token(&self.syntax)
5948 } 6476 }
5949} 6477}
5950#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6478#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6003,11 +6531,23 @@ impl AstNode for TypeParamList {
6003 } 6531 }
6004} 6532}
6005impl TypeParamList { 6533impl TypeParamList {
6534 pub fn l_angle(&self) -> Option<LAngle> {
6535 support::token(&self.syntax)
6536 }
6537 pub fn generic_params(&self) -> AstChildren<GenericParam> {
6538 support::children(&self.syntax)
6539 }
6006 pub fn type_params(&self) -> AstChildren<TypeParam> { 6540 pub fn type_params(&self) -> AstChildren<TypeParam> {
6007 AstChildren::new(&self.syntax) 6541 support::children(&self.syntax)
6008 } 6542 }
6009 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { 6543 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> {
6010 AstChildren::new(&self.syntax) 6544 support::children(&self.syntax)
6545 }
6546 pub fn const_params(&self) -> AstChildren<ConstParam> {
6547 support::children(&self.syntax)
6548 }
6549 pub fn r_angle(&self) -> Option<RAngle> {
6550 support::token(&self.syntax)
6011 } 6551 }
6012} 6552}
6013#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6553#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6041,8 +6581,11 @@ impl ast::NameOwner for TypeParam {}
6041impl ast::AttrsOwner for TypeParam {} 6581impl ast::AttrsOwner for TypeParam {}
6042impl ast::TypeBoundsOwner for TypeParam {} 6582impl ast::TypeBoundsOwner for TypeParam {}
6043impl TypeParam { 6583impl TypeParam {
6584 pub fn eq(&self) -> Option<Eq> {
6585 support::token(&self.syntax)
6586 }
6044 pub fn default_type(&self) -> Option<TypeRef> { 6587 pub fn default_type(&self) -> Option<TypeRef> {
6045 AstChildren::new(&self.syntax).next() 6588 support::child(&self.syntax)
6046 } 6589 }
6047} 6590}
6048#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6591#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6076,8 +6619,11 @@ impl ast::NameOwner for ConstParam {}
6076impl ast::AttrsOwner for ConstParam {} 6619impl ast::AttrsOwner for ConstParam {}
6077impl ast::TypeAscriptionOwner for ConstParam {} 6620impl ast::TypeAscriptionOwner for ConstParam {}
6078impl ConstParam { 6621impl ConstParam {
6622 pub fn eq(&self) -> Option<Eq> {
6623 support::token(&self.syntax)
6624 }
6079 pub fn default_val(&self) -> Option<Expr> { 6625 pub fn default_val(&self) -> Option<Expr> {
6080 AstChildren::new(&self.syntax).next() 6626 support::child(&self.syntax)
6081 } 6627 }
6082} 6628}
6083#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6629#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6108,7 +6654,11 @@ impl AstNode for LifetimeParam {
6108 } 6654 }
6109} 6655}
6110impl ast::AttrsOwner for LifetimeParam {} 6656impl ast::AttrsOwner for LifetimeParam {}
6111impl LifetimeParam {} 6657impl LifetimeParam {
6658 pub fn lifetime(&self) -> Option<Lifetime> {
6659 support::token(&self.syntax)
6660 }
6661}
6112#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6662#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6113pub struct TypeBound { 6663pub struct TypeBound {
6114 pub(crate) syntax: SyntaxNode, 6664 pub(crate) syntax: SyntaxNode,
@@ -6137,8 +6687,14 @@ impl AstNode for TypeBound {
6137 } 6687 }
6138} 6688}
6139impl TypeBound { 6689impl TypeBound {
6690 pub fn lifetime(&self) -> Option<Lifetime> {
6691 support::token(&self.syntax)
6692 }
6693 pub fn const_kw(&self) -> Option<ConstKw> {
6694 support::token(&self.syntax)
6695 }
6140 pub fn type_ref(&self) -> Option<TypeRef> { 6696 pub fn type_ref(&self) -> Option<TypeRef> {
6141 AstChildren::new(&self.syntax).next() 6697 support::child(&self.syntax)
6142 } 6698 }
6143} 6699}
6144#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6700#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6170,7 +6726,7 @@ impl AstNode for TypeBoundList {
6170} 6726}
6171impl TypeBoundList { 6727impl TypeBoundList {
6172 pub fn bounds(&self) -> AstChildren<TypeBound> { 6728 pub fn bounds(&self) -> AstChildren<TypeBound> {
6173 AstChildren::new(&self.syntax) 6729 support::children(&self.syntax)
6174 } 6730 }
6175} 6731}
6176#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6732#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6202,8 +6758,11 @@ impl AstNode for WherePred {
6202} 6758}
6203impl ast::TypeBoundsOwner for WherePred {} 6759impl ast::TypeBoundsOwner for WherePred {}
6204impl WherePred { 6760impl WherePred {
6761 pub fn lifetime(&self) -> Option<Lifetime> {
6762 support::token(&self.syntax)
6763 }
6205 pub fn type_ref(&self) -> Option<TypeRef> { 6764 pub fn type_ref(&self) -> Option<TypeRef> {
6206 AstChildren::new(&self.syntax).next() 6765 support::child(&self.syntax)
6207 } 6766 }
6208} 6767}
6209#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6768#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6234,8 +6793,43 @@ impl AstNode for WhereClause {
6234 } 6793 }
6235} 6794}
6236impl WhereClause { 6795impl WhereClause {
6796 pub fn where_kw(&self) -> Option<WhereKw> {
6797 support::token(&self.syntax)
6798 }
6237 pub fn predicates(&self) -> AstChildren<WherePred> { 6799 pub fn predicates(&self) -> AstChildren<WherePred> {
6238 AstChildren::new(&self.syntax) 6800 support::children(&self.syntax)
6801 }
6802}
6803#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6804pub struct Abi {
6805 pub(crate) syntax: SyntaxNode,
6806}
6807impl std::fmt::Display for Abi {
6808 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6809 std::fmt::Display::fmt(self.syntax(), f)
6810 }
6811}
6812impl AstNode for Abi {
6813 fn can_cast(kind: SyntaxKind) -> bool {
6814 match kind {
6815 ABI => true,
6816 _ => false,
6817 }
6818 }
6819 fn cast(syntax: SyntaxNode) -> Option<Self> {
6820 if Self::can_cast(syntax.kind()) {
6821 Some(Self { syntax })
6822 } else {
6823 None
6824 }
6825 }
6826 fn syntax(&self) -> &SyntaxNode {
6827 &self.syntax
6828 }
6829}
6830impl Abi {
6831 pub fn string(&self) -> Option<String> {
6832 support::token(&self.syntax)
6239 } 6833 }
6240} 6834}
6241#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6835#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6265,9 +6859,13 @@ impl AstNode for ExprStmt {
6265 &self.syntax 6859 &self.syntax
6266 } 6860 }
6267} 6861}
6862impl ast::AttrsOwner for ExprStmt {}
6268impl ExprStmt { 6863impl ExprStmt {
6269 pub fn expr(&self) -> Option<Expr> { 6864 pub fn expr(&self) -> Option<Expr> {
6270 AstChildren::new(&self.syntax).next() 6865 support::child(&self.syntax)
6866 }
6867 pub fn semi(&self) -> Option<Semi> {
6868 support::token(&self.syntax)
6271 } 6869 }
6272} 6870}
6273#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6871#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6297,13 +6895,20 @@ impl AstNode for LetStmt {
6297 &self.syntax 6895 &self.syntax
6298 } 6896 }
6299} 6897}
6898impl ast::AttrsOwner for LetStmt {}
6300impl ast::TypeAscriptionOwner for LetStmt {} 6899impl ast::TypeAscriptionOwner for LetStmt {}
6301impl LetStmt { 6900impl LetStmt {
6901 pub fn let_kw(&self) -> Option<LetKw> {
6902 support::token(&self.syntax)
6903 }
6302 pub fn pat(&self) -> Option<Pat> { 6904 pub fn pat(&self) -> Option<Pat> {
6303 AstChildren::new(&self.syntax).next() 6905 support::child(&self.syntax)
6906 }
6907 pub fn eq(&self) -> Option<Eq> {
6908 support::token(&self.syntax)
6304 } 6909 }
6305 pub fn initializer(&self) -> Option<Expr> { 6910 pub fn initializer(&self) -> Option<Expr> {
6306 AstChildren::new(&self.syntax).next() 6911 support::child(&self.syntax)
6307 } 6912 }
6308} 6913}
6309#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6914#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6334,11 +6939,17 @@ impl AstNode for Condition {
6334 } 6939 }
6335} 6940}
6336impl Condition { 6941impl Condition {
6942 pub fn let_kw(&self) -> Option<LetKw> {
6943 support::token(&self.syntax)
6944 }
6337 pub fn pat(&self) -> Option<Pat> { 6945 pub fn pat(&self) -> Option<Pat> {
6338 AstChildren::new(&self.syntax).next() 6946 support::child(&self.syntax)
6947 }
6948 pub fn eq(&self) -> Option<Eq> {
6949 support::token(&self.syntax)
6339 } 6950 }
6340 pub fn expr(&self) -> Option<Expr> { 6951 pub fn expr(&self) -> Option<Expr> {
6341 AstChildren::new(&self.syntax).next() 6952 support::child(&self.syntax)
6342 } 6953 }
6343} 6954}
6344#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6955#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6371,11 +6982,17 @@ impl AstNode for Block {
6371impl ast::AttrsOwner for Block {} 6982impl ast::AttrsOwner for Block {}
6372impl ast::ModuleItemOwner for Block {} 6983impl ast::ModuleItemOwner for Block {}
6373impl Block { 6984impl Block {
6985 pub fn l_curly(&self) -> Option<LCurly> {
6986 support::token(&self.syntax)
6987 }
6374 pub fn statements(&self) -> AstChildren<Stmt> { 6988 pub fn statements(&self) -> AstChildren<Stmt> {
6375 AstChildren::new(&self.syntax) 6989 support::children(&self.syntax)
6376 } 6990 }
6377 pub fn expr(&self) -> Option<Expr> { 6991 pub fn expr(&self) -> Option<Expr> {
6378 AstChildren::new(&self.syntax).next() 6992 support::child(&self.syntax)
6993 }
6994 pub fn r_curly(&self) -> Option<RCurly> {
6995 support::token(&self.syntax)
6379 } 6996 }
6380} 6997}
6381#[derive(Debug, Clone, PartialEq, Eq, Hash)] 6998#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6406,11 +7023,17 @@ impl AstNode for ParamList {
6406 } 7023 }
6407} 7024}
6408impl ParamList { 7025impl ParamList {
7026 pub fn l_paren(&self) -> Option<LParen> {
7027 support::token(&self.syntax)
7028 }
6409 pub fn self_param(&self) -> Option<SelfParam> { 7029 pub fn self_param(&self) -> Option<SelfParam> {
6410 AstChildren::new(&self.syntax).next() 7030 support::child(&self.syntax)
6411 } 7031 }
6412 pub fn params(&self) -> AstChildren<Param> { 7032 pub fn params(&self) -> AstChildren<Param> {
6413 AstChildren::new(&self.syntax) 7033 support::children(&self.syntax)
7034 }
7035 pub fn r_paren(&self) -> Option<RParen> {
7036 support::token(&self.syntax)
6414 } 7037 }
6415} 7038}
6416#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7039#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6442,7 +7065,17 @@ impl AstNode for SelfParam {
6442} 7065}
6443impl ast::TypeAscriptionOwner for SelfParam {} 7066impl ast::TypeAscriptionOwner for SelfParam {}
6444impl ast::AttrsOwner for SelfParam {} 7067impl ast::AttrsOwner for SelfParam {}
6445impl SelfParam {} 7068impl SelfParam {
7069 pub fn amp(&self) -> Option<Amp> {
7070 support::token(&self.syntax)
7071 }
7072 pub fn lifetime(&self) -> Option<Lifetime> {
7073 support::token(&self.syntax)
7074 }
7075 pub fn self_kw(&self) -> Option<SelfKw> {
7076 support::token(&self.syntax)
7077 }
7078}
6446#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7079#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6447pub struct Param { 7080pub struct Param {
6448 pub(crate) syntax: SyntaxNode, 7081 pub(crate) syntax: SyntaxNode,
@@ -6474,7 +7107,10 @@ impl ast::TypeAscriptionOwner for Param {}
6474impl ast::AttrsOwner for Param {} 7107impl ast::AttrsOwner for Param {}
6475impl Param { 7108impl Param {
6476 pub fn pat(&self) -> Option<Pat> { 7109 pub fn pat(&self) -> Option<Pat> {
6477 AstChildren::new(&self.syntax).next() 7110 support::child(&self.syntax)
7111 }
7112 pub fn dotdotdot(&self) -> Option<Dotdotdot> {
7113 support::token(&self.syntax)
6478 } 7114 }
6479} 7115}
6480#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7116#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6507,8 +7143,11 @@ impl AstNode for UseItem {
6507impl ast::AttrsOwner for UseItem {} 7143impl ast::AttrsOwner for UseItem {}
6508impl ast::VisibilityOwner for UseItem {} 7144impl ast::VisibilityOwner for UseItem {}
6509impl UseItem { 7145impl UseItem {
7146 pub fn use_kw(&self) -> Option<UseKw> {
7147 support::token(&self.syntax)
7148 }
6510 pub fn use_tree(&self) -> Option<UseTree> { 7149 pub fn use_tree(&self) -> Option<UseTree> {
6511 AstChildren::new(&self.syntax).next() 7150 support::child(&self.syntax)
6512 } 7151 }
6513} 7152}
6514#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7153#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6540,13 +7179,16 @@ impl AstNode for UseTree {
6540} 7179}
6541impl UseTree { 7180impl UseTree {
6542 pub fn path(&self) -> Option<Path> { 7181 pub fn path(&self) -> Option<Path> {
6543 AstChildren::new(&self.syntax).next() 7182 support::child(&self.syntax)
7183 }
7184 pub fn star(&self) -> Option<Star> {
7185 support::token(&self.syntax)
6544 } 7186 }
6545 pub fn use_tree_list(&self) -> Option<UseTreeList> { 7187 pub fn use_tree_list(&self) -> Option<UseTreeList> {
6546 AstChildren::new(&self.syntax).next() 7188 support::child(&self.syntax)
6547 } 7189 }
6548 pub fn alias(&self) -> Option<Alias> { 7190 pub fn alias(&self) -> Option<Alias> {
6549 AstChildren::new(&self.syntax).next() 7191 support::child(&self.syntax)
6550 } 7192 }
6551} 7193}
6552#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7194#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6577,7 +7219,11 @@ impl AstNode for Alias {
6577 } 7219 }
6578} 7220}
6579impl ast::NameOwner for Alias {} 7221impl ast::NameOwner for Alias {}
6580impl Alias {} 7222impl Alias {
7223 pub fn as_kw(&self) -> Option<AsKw> {
7224 support::token(&self.syntax)
7225 }
7226}
6581#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7227#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6582pub struct UseTreeList { 7228pub struct UseTreeList {
6583 pub(crate) syntax: SyntaxNode, 7229 pub(crate) syntax: SyntaxNode,
@@ -6606,8 +7252,14 @@ impl AstNode for UseTreeList {
6606 } 7252 }
6607} 7253}
6608impl UseTreeList { 7254impl UseTreeList {
7255 pub fn l_curly(&self) -> Option<LCurly> {
7256 support::token(&self.syntax)
7257 }
6609 pub fn use_trees(&self) -> AstChildren<UseTree> { 7258 pub fn use_trees(&self) -> AstChildren<UseTree> {
6610 AstChildren::new(&self.syntax) 7259 support::children(&self.syntax)
7260 }
7261 pub fn r_curly(&self) -> Option<RCurly> {
7262 support::token(&self.syntax)
6611 } 7263 }
6612} 7264}
6613#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7265#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6640,11 +7292,17 @@ impl AstNode for ExternCrateItem {
6640impl ast::AttrsOwner for ExternCrateItem {} 7292impl ast::AttrsOwner for ExternCrateItem {}
6641impl ast::VisibilityOwner for ExternCrateItem {} 7293impl ast::VisibilityOwner for ExternCrateItem {}
6642impl ExternCrateItem { 7294impl ExternCrateItem {
7295 pub fn extern_kw(&self) -> Option<ExternKw> {
7296 support::token(&self.syntax)
7297 }
7298 pub fn crate_kw(&self) -> Option<CrateKw> {
7299 support::token(&self.syntax)
7300 }
6643 pub fn name_ref(&self) -> Option<NameRef> { 7301 pub fn name_ref(&self) -> Option<NameRef> {
6644 AstChildren::new(&self.syntax).next() 7302 support::child(&self.syntax)
6645 } 7303 }
6646 pub fn alias(&self) -> Option<Alias> { 7304 pub fn alias(&self) -> Option<Alias> {
6647 AstChildren::new(&self.syntax).next() 7305 support::child(&self.syntax)
6648 } 7306 }
6649} 7307}
6650#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7308#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6675,8 +7333,14 @@ impl AstNode for ArgList {
6675 } 7333 }
6676} 7334}
6677impl ArgList { 7335impl ArgList {
7336 pub fn l_paren(&self) -> Option<LParen> {
7337 support::token(&self.syntax)
7338 }
6678 pub fn args(&self) -> AstChildren<Expr> { 7339 pub fn args(&self) -> AstChildren<Expr> {
6679 AstChildren::new(&self.syntax) 7340 support::children(&self.syntax)
7341 }
7342 pub fn r_paren(&self) -> Option<RParen> {
7343 support::token(&self.syntax)
6680 } 7344 }
6681} 7345}
6682#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7346#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6708,10 +7372,10 @@ impl AstNode for Path {
6708} 7372}
6709impl Path { 7373impl Path {
6710 pub fn segment(&self) -> Option<PathSegment> { 7374 pub fn segment(&self) -> Option<PathSegment> {
6711 AstChildren::new(&self.syntax).next() 7375 support::child(&self.syntax)
6712 } 7376 }
6713 pub fn qualifier(&self) -> Option<Path> { 7377 pub fn qualifier(&self) -> Option<Path> {
6714 AstChildren::new(&self.syntax).next() 7378 support::child(&self.syntax)
6715 } 7379 }
6716} 7380}
6717#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7381#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6742,20 +7406,29 @@ impl AstNode for PathSegment {
6742 } 7406 }
6743} 7407}
6744impl PathSegment { 7408impl PathSegment {
7409 pub fn coloncolon(&self) -> Option<Coloncolon> {
7410 support::token(&self.syntax)
7411 }
7412 pub fn l_angle(&self) -> Option<LAngle> {
7413 support::token(&self.syntax)
7414 }
6745 pub fn name_ref(&self) -> Option<NameRef> { 7415 pub fn name_ref(&self) -> Option<NameRef> {
6746 AstChildren::new(&self.syntax).next() 7416 support::child(&self.syntax)
6747 } 7417 }
6748 pub fn type_arg_list(&self) -> Option<TypeArgList> { 7418 pub fn type_arg_list(&self) -> Option<TypeArgList> {
6749 AstChildren::new(&self.syntax).next() 7419 support::child(&self.syntax)
6750 } 7420 }
6751 pub fn param_list(&self) -> Option<ParamList> { 7421 pub fn param_list(&self) -> Option<ParamList> {
6752 AstChildren::new(&self.syntax).next() 7422 support::child(&self.syntax)
6753 } 7423 }
6754 pub fn ret_type(&self) -> Option<RetType> { 7424 pub fn ret_type(&self) -> Option<RetType> {
6755 AstChildren::new(&self.syntax).next() 7425 support::child(&self.syntax)
6756 } 7426 }
6757 pub fn path_type(&self) -> Option<PathType> { 7427 pub fn path_type(&self) -> Option<PathType> {
6758 AstChildren::new(&self.syntax).next() 7428 support::child(&self.syntax)
7429 }
7430 pub fn r_angle(&self) -> Option<RAngle> {
7431 support::token(&self.syntax)
6759 } 7432 }
6760} 7433}
6761#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7434#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6786,17 +7459,29 @@ impl AstNode for TypeArgList {
6786 } 7459 }
6787} 7460}
6788impl TypeArgList { 7461impl TypeArgList {
7462 pub fn coloncolon(&self) -> Option<Coloncolon> {
7463 support::token(&self.syntax)
7464 }
7465 pub fn l_angle(&self) -> Option<LAngle> {
7466 support::token(&self.syntax)
7467 }
7468 pub fn generic_args(&self) -> AstChildren<GenericArg> {
7469 support::children(&self.syntax)
7470 }
6789 pub fn type_args(&self) -> AstChildren<TypeArg> { 7471 pub fn type_args(&self) -> AstChildren<TypeArg> {
6790 AstChildren::new(&self.syntax) 7472 support::children(&self.syntax)
6791 } 7473 }
6792 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { 7474 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> {
6793 AstChildren::new(&self.syntax) 7475 support::children(&self.syntax)
6794 } 7476 }
6795 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { 7477 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> {
6796 AstChildren::new(&self.syntax) 7478 support::children(&self.syntax)
7479 }
7480 pub fn const_args(&self) -> AstChildren<ConstArg> {
7481 support::children(&self.syntax)
6797 } 7482 }
6798 pub fn const_arg(&self) -> AstChildren<ConstArg> { 7483 pub fn r_angle(&self) -> Option<RAngle> {
6799 AstChildren::new(&self.syntax) 7484 support::token(&self.syntax)
6800 } 7485 }
6801} 7486}
6802#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7487#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6828,7 +7513,7 @@ impl AstNode for TypeArg {
6828} 7513}
6829impl TypeArg { 7514impl TypeArg {
6830 pub fn type_ref(&self) -> Option<TypeRef> { 7515 pub fn type_ref(&self) -> Option<TypeRef> {
6831 AstChildren::new(&self.syntax).next() 7516 support::child(&self.syntax)
6832 } 7517 }
6833} 7518}
6834#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7519#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6858,12 +7543,16 @@ impl AstNode for AssocTypeArg {
6858 &self.syntax 7543 &self.syntax
6859 } 7544 }
6860} 7545}
7546impl ast::TypeBoundsOwner for AssocTypeArg {}
6861impl AssocTypeArg { 7547impl AssocTypeArg {
6862 pub fn name_ref(&self) -> Option<NameRef> { 7548 pub fn name_ref(&self) -> Option<NameRef> {
6863 AstChildren::new(&self.syntax).next() 7549 support::child(&self.syntax)
7550 }
7551 pub fn eq(&self) -> Option<Eq> {
7552 support::token(&self.syntax)
6864 } 7553 }
6865 pub fn type_ref(&self) -> Option<TypeRef> { 7554 pub fn type_ref(&self) -> Option<TypeRef> {
6866 AstChildren::new(&self.syntax).next() 7555 support::child(&self.syntax)
6867 } 7556 }
6868} 7557}
6869#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7558#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6893,7 +7582,11 @@ impl AstNode for LifetimeArg {
6893 &self.syntax 7582 &self.syntax
6894 } 7583 }
6895} 7584}
6896impl LifetimeArg {} 7585impl LifetimeArg {
7586 pub fn lifetime(&self) -> Option<Lifetime> {
7587 support::token(&self.syntax)
7588 }
7589}
6897#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7590#[derive(Debug, Clone, PartialEq, Eq, Hash)]
6898pub struct ConstArg { 7591pub struct ConstArg {
6899 pub(crate) syntax: SyntaxNode, 7592 pub(crate) syntax: SyntaxNode,
@@ -6923,10 +7616,13 @@ impl AstNode for ConstArg {
6923} 7616}
6924impl ConstArg { 7617impl ConstArg {
6925 pub fn literal(&self) -> Option<Literal> { 7618 pub fn literal(&self) -> Option<Literal> {
6926 AstChildren::new(&self.syntax).next() 7619 support::child(&self.syntax)
7620 }
7621 pub fn eq(&self) -> Option<Eq> {
7622 support::token(&self.syntax)
6927 } 7623 }
6928 pub fn block_expr(&self) -> Option<BlockExpr> { 7624 pub fn block_expr(&self) -> Option<BlockExpr> {
6929 AstChildren::new(&self.syntax).next() 7625 support::child(&self.syntax)
6930 } 7626 }
6931} 7627}
6932#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7628#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -6988,10 +7684,161 @@ impl AstNode for MacroStmts {
6988} 7684}
6989impl MacroStmts { 7685impl MacroStmts {
6990 pub fn statements(&self) -> AstChildren<Stmt> { 7686 pub fn statements(&self) -> AstChildren<Stmt> {
6991 AstChildren::new(&self.syntax) 7687 support::children(&self.syntax)
6992 } 7688 }
6993 pub fn expr(&self) -> Option<Expr> { 7689 pub fn expr(&self) -> Option<Expr> {
6994 AstChildren::new(&self.syntax).next() 7690 support::child(&self.syntax)
7691 }
7692}
7693#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7694pub struct ExternItemList {
7695 pub(crate) syntax: SyntaxNode,
7696}
7697impl std::fmt::Display for ExternItemList {
7698 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7699 std::fmt::Display::fmt(self.syntax(), f)
7700 }
7701}
7702impl AstNode for ExternItemList {
7703 fn can_cast(kind: SyntaxKind) -> bool {
7704 match kind {
7705 EXTERN_ITEM_LIST => true,
7706 _ => false,
7707 }
7708 }
7709 fn cast(syntax: SyntaxNode) -> Option<Self> {
7710 if Self::can_cast(syntax.kind()) {
7711 Some(Self { syntax })
7712 } else {
7713 None
7714 }
7715 }
7716 fn syntax(&self) -> &SyntaxNode {
7717 &self.syntax
7718 }
7719}
7720impl ast::FnDefOwner for ExternItemList {}
7721impl ast::ModuleItemOwner for ExternItemList {}
7722impl ExternItemList {
7723 pub fn l_curly(&self) -> Option<LCurly> {
7724 support::token(&self.syntax)
7725 }
7726 pub fn extern_items(&self) -> AstChildren<ExternItem> {
7727 support::children(&self.syntax)
7728 }
7729 pub fn r_curly(&self) -> Option<RCurly> {
7730 support::token(&self.syntax)
7731 }
7732}
7733#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7734pub struct ExternBlock {
7735 pub(crate) syntax: SyntaxNode,
7736}
7737impl std::fmt::Display for ExternBlock {
7738 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7739 std::fmt::Display::fmt(self.syntax(), f)
7740 }
7741}
7742impl AstNode for ExternBlock {
7743 fn can_cast(kind: SyntaxKind) -> bool {
7744 match kind {
7745 EXTERN_BLOCK => true,
7746 _ => false,
7747 }
7748 }
7749 fn cast(syntax: SyntaxNode) -> Option<Self> {
7750 if Self::can_cast(syntax.kind()) {
7751 Some(Self { syntax })
7752 } else {
7753 None
7754 }
7755 }
7756 fn syntax(&self) -> &SyntaxNode {
7757 &self.syntax
7758 }
7759}
7760impl ExternBlock {
7761 pub fn abi(&self) -> Option<Abi> {
7762 support::child(&self.syntax)
7763 }
7764 pub fn extern_item_list(&self) -> Option<ExternItemList> {
7765 support::child(&self.syntax)
7766 }
7767}
7768#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7769pub struct MetaItem {
7770 pub(crate) syntax: SyntaxNode,
7771}
7772impl std::fmt::Display for MetaItem {
7773 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7774 std::fmt::Display::fmt(self.syntax(), f)
7775 }
7776}
7777impl AstNode for MetaItem {
7778 fn can_cast(kind: SyntaxKind) -> bool {
7779 match kind {
7780 META_ITEM => true,
7781 _ => false,
7782 }
7783 }
7784 fn cast(syntax: SyntaxNode) -> Option<Self> {
7785 if Self::can_cast(syntax.kind()) {
7786 Some(Self { syntax })
7787 } else {
7788 None
7789 }
7790 }
7791 fn syntax(&self) -> &SyntaxNode {
7792 &self.syntax
7793 }
7794}
7795impl MetaItem {
7796 pub fn path(&self) -> Option<Path> {
7797 support::child(&self.syntax)
7798 }
7799 pub fn eq(&self) -> Option<Eq> {
7800 support::token(&self.syntax)
7801 }
7802 pub fn attr_input(&self) -> Option<AttrInput> {
7803 support::child(&self.syntax)
7804 }
7805 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> {
7806 support::children(&self.syntax)
7807 }
7808}
7809#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7810pub struct MacroDef {
7811 pub(crate) syntax: SyntaxNode,
7812}
7813impl std::fmt::Display for MacroDef {
7814 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7815 std::fmt::Display::fmt(self.syntax(), f)
7816 }
7817}
7818impl AstNode for MacroDef {
7819 fn can_cast(kind: SyntaxKind) -> bool {
7820 match kind {
7821 MACRO_DEF => true,
7822 _ => false,
7823 }
7824 }
7825 fn cast(syntax: SyntaxNode) -> Option<Self> {
7826 if Self::can_cast(syntax.kind()) {
7827 Some(Self { syntax })
7828 } else {
7829 None
7830 }
7831 }
7832 fn syntax(&self) -> &SyntaxNode {
7833 &self.syntax
7834 }
7835}
7836impl MacroDef {
7837 pub fn name(&self) -> Option<Name> {
7838 support::child(&self.syntax)
7839 }
7840 pub fn token_tree(&self) -> Option<TokenTree> {
7841 support::child(&self.syntax)
6995 } 7842 }
6996} 7843}
6997#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7844#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -7048,6 +7895,114 @@ impl ast::NameOwner for NominalDef {}
7048impl ast::TypeParamsOwner for NominalDef {} 7895impl ast::TypeParamsOwner for NominalDef {}
7049impl ast::AttrsOwner for NominalDef {} 7896impl ast::AttrsOwner for NominalDef {}
7050#[derive(Debug, Clone, PartialEq, Eq, Hash)] 7897#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7898pub enum GenericParam {
7899 LifetimeParam(LifetimeParam),
7900 TypeParam(TypeParam),
7901 ConstParam(ConstParam),
7902}
7903impl From<LifetimeParam> for GenericParam {
7904 fn from(node: LifetimeParam) -> GenericParam {
7905 GenericParam::LifetimeParam(node)
7906 }
7907}
7908impl From<TypeParam> for GenericParam {
7909 fn from(node: TypeParam) -> GenericParam {
7910 GenericParam::TypeParam(node)
7911 }
7912}
7913impl From<ConstParam> for GenericParam {
7914 fn from(node: ConstParam) -> GenericParam {
7915 GenericParam::ConstParam(node)
7916 }
7917}
7918impl std::fmt::Display for GenericParam {
7919 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7920 std::fmt::Display::fmt(self.syntax(), f)
7921 }
7922}
7923impl AstNode for GenericParam {
7924 fn can_cast(kind: SyntaxKind) -> bool {
7925 match kind {
7926 LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true,
7927 _ => false,
7928 }
7929 }
7930 fn cast(syntax: SyntaxNode) -> Option<Self> {
7931 let res = match syntax.kind() {
7932 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
7933 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
7934 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
7935 _ => return None,
7936 };
7937 Some(res)
7938 }
7939 fn syntax(&self) -> &SyntaxNode {
7940 match self {
7941 GenericParam::LifetimeParam(it) => &it.syntax,
7942 GenericParam::TypeParam(it) => &it.syntax,
7943 GenericParam::ConstParam(it) => &it.syntax,
7944 }
7945 }
7946}
7947#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7948pub enum GenericArg {
7949 LifetimeArg(LifetimeArg),
7950 TypeArg(TypeArg),
7951 ConstArg(ConstArg),
7952 AssocTypeArg(AssocTypeArg),
7953}
7954impl From<LifetimeArg> for GenericArg {
7955 fn from(node: LifetimeArg) -> GenericArg {
7956 GenericArg::LifetimeArg(node)
7957 }
7958}
7959impl From<TypeArg> for GenericArg {
7960 fn from(node: TypeArg) -> GenericArg {
7961 GenericArg::TypeArg(node)
7962 }
7963}
7964impl From<ConstArg> for GenericArg {
7965 fn from(node: ConstArg) -> GenericArg {
7966 GenericArg::ConstArg(node)
7967 }
7968}
7969impl From<AssocTypeArg> for GenericArg {
7970 fn from(node: AssocTypeArg) -> GenericArg {
7971 GenericArg::AssocTypeArg(node)
7972 }
7973}
7974impl std::fmt::Display for GenericArg {
7975 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7976 std::fmt::Display::fmt(self.syntax(), f)
7977 }
7978}
7979impl AstNode for GenericArg {
7980 fn can_cast(kind: SyntaxKind) -> bool {
7981 match kind {
7982 LIFETIME_ARG | TYPE_ARG | CONST_ARG | ASSOC_TYPE_ARG => true,
7983 _ => false,
7984 }
7985 }
7986 fn cast(syntax: SyntaxNode) -> Option<Self> {
7987 let res = match syntax.kind() {
7988 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
7989 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
7990 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
7991 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
7992 _ => return None,
7993 };
7994 Some(res)
7995 }
7996 fn syntax(&self) -> &SyntaxNode {
7997 match self {
7998 GenericArg::LifetimeArg(it) => &it.syntax,
7999 GenericArg::TypeArg(it) => &it.syntax,
8000 GenericArg::ConstArg(it) => &it.syntax,
8001 GenericArg::AssocTypeArg(it) => &it.syntax,
8002 }
8003 }
8004}
8005#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7051pub enum TypeRef { 8006pub enum TypeRef {
7052 ParenType(ParenType), 8007 ParenType(ParenType),
7053 TupleType(TupleType), 8008 TupleType(TupleType),
@@ -7194,6 +8149,7 @@ pub enum ModuleItem {
7194 StaticDef(StaticDef), 8149 StaticDef(StaticDef),
7195 Module(Module), 8150 Module(Module),
7196 MacroCall(MacroCall), 8151 MacroCall(MacroCall),
8152 ExternBlock(ExternBlock),
7197} 8153}
7198impl From<StructDef> for ModuleItem { 8154impl From<StructDef> for ModuleItem {
7199 fn from(node: StructDef) -> ModuleItem { 8155 fn from(node: StructDef) -> ModuleItem {
@@ -7260,6 +8216,11 @@ impl From<MacroCall> for ModuleItem {
7260 ModuleItem::MacroCall(node) 8216 ModuleItem::MacroCall(node)
7261 } 8217 }
7262} 8218}
8219impl From<ExternBlock> for ModuleItem {
8220 fn from(node: ExternBlock) -> ModuleItem {
8221 ModuleItem::ExternBlock(node)
8222 }
8223}
7263impl std::fmt::Display for ModuleItem { 8224impl std::fmt::Display for ModuleItem {
7264 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 8225 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7265 std::fmt::Display::fmt(self.syntax(), f) 8226 std::fmt::Display::fmt(self.syntax(), f)
@@ -7269,7 +8230,8 @@ impl AstNode for ModuleItem {
7269 fn can_cast(kind: SyntaxKind) -> bool { 8230 fn can_cast(kind: SyntaxKind) -> bool {
7270 match kind { 8231 match kind {
7271 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF 8232 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF
7272 | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL => true, 8233 | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL
8234 | EXTERN_BLOCK => true,
7273 _ => false, 8235 _ => false,
7274 } 8236 }
7275 } 8237 }
@@ -7288,6 +8250,7 @@ impl AstNode for ModuleItem {
7288 STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }), 8250 STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }),
7289 MODULE => ModuleItem::Module(Module { syntax }), 8251 MODULE => ModuleItem::Module(Module { syntax }),
7290 MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }), 8252 MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }),
8253 EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }),
7291 _ => return None, 8254 _ => return None,
7292 }; 8255 };
7293 Some(res) 8256 Some(res)
@@ -7307,9 +8270,11 @@ impl AstNode for ModuleItem {
7307 ModuleItem::StaticDef(it) => &it.syntax, 8270 ModuleItem::StaticDef(it) => &it.syntax,
7308 ModuleItem::Module(it) => &it.syntax, 8271 ModuleItem::Module(it) => &it.syntax,
7309 ModuleItem::MacroCall(it) => &it.syntax, 8272 ModuleItem::MacroCall(it) => &it.syntax,
8273 ModuleItem::ExternBlock(it) => &it.syntax,
7310 } 8274 }
7311 } 8275 }
7312} 8276}
8277impl ast::NameOwner for ModuleItem {}
7313impl ast::AttrsOwner for ModuleItem {} 8278impl ast::AttrsOwner for ModuleItem {}
7314impl ast::VisibilityOwner for ModuleItem {} 8279impl ast::VisibilityOwner for ModuleItem {}
7315#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8280#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -7362,8 +8327,54 @@ impl AstNode for ImplItem {
7362 } 8327 }
7363 } 8328 }
7364} 8329}
8330impl ast::NameOwner for ImplItem {}
7365impl ast::AttrsOwner for ImplItem {} 8331impl ast::AttrsOwner for ImplItem {}
7366#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8332#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8333pub enum ExternItem {
8334 FnDef(FnDef),
8335 StaticDef(StaticDef),
8336}
8337impl From<FnDef> for ExternItem {
8338 fn from(node: FnDef) -> ExternItem {
8339 ExternItem::FnDef(node)
8340 }
8341}
8342impl From<StaticDef> for ExternItem {
8343 fn from(node: StaticDef) -> ExternItem {
8344 ExternItem::StaticDef(node)
8345 }
8346}
8347impl std::fmt::Display for ExternItem {
8348 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
8349 std::fmt::Display::fmt(self.syntax(), f)
8350 }
8351}
8352impl AstNode for ExternItem {
8353 fn can_cast(kind: SyntaxKind) -> bool {
8354 match kind {
8355 FN_DEF | STATIC_DEF => true,
8356 _ => false,
8357 }
8358 }
8359 fn cast(syntax: SyntaxNode) -> Option<Self> {
8360 let res = match syntax.kind() {
8361 FN_DEF => ExternItem::FnDef(FnDef { syntax }),
8362 STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }),
8363 _ => return None,
8364 };
8365 Some(res)
8366 }
8367 fn syntax(&self) -> &SyntaxNode {
8368 match self {
8369 ExternItem::FnDef(it) => &it.syntax,
8370 ExternItem::StaticDef(it) => &it.syntax,
8371 }
8372 }
8373}
8374impl ast::NameOwner for ExternItem {}
8375impl ast::AttrsOwner for ExternItem {}
8376impl ast::VisibilityOwner for ExternItem {}
8377#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7367pub enum Expr { 8378pub enum Expr {
7368 TupleExpr(TupleExpr), 8379 TupleExpr(TupleExpr),
7369 ArrayExpr(ArrayExpr), 8380 ArrayExpr(ArrayExpr),
@@ -7642,6 +8653,7 @@ impl AstNode for Expr {
7642 } 8653 }
7643 } 8654 }
7644} 8655}
8656impl ast::AttrsOwner for Expr {}
7645#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8657#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7646pub enum Pat { 8658pub enum Pat {
7647 OrPat(OrPat), 8659 OrPat(OrPat),
@@ -7791,6 +8803,48 @@ impl AstNode for Pat {
7791 } 8803 }
7792} 8804}
7793#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8805#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8806pub enum RecordInnerPat {
8807 RecordFieldPat(RecordFieldPat),
8808 BindPat(BindPat),
8809}
8810impl From<RecordFieldPat> for RecordInnerPat {
8811 fn from(node: RecordFieldPat) -> RecordInnerPat {
8812 RecordInnerPat::RecordFieldPat(node)
8813 }
8814}
8815impl From<BindPat> for RecordInnerPat {
8816 fn from(node: BindPat) -> RecordInnerPat {
8817 RecordInnerPat::BindPat(node)
8818 }
8819}
8820impl std::fmt::Display for RecordInnerPat {
8821 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
8822 std::fmt::Display::fmt(self.syntax(), f)
8823 }
8824}
8825impl AstNode for RecordInnerPat {
8826 fn can_cast(kind: SyntaxKind) -> bool {
8827 match kind {
8828 RECORD_FIELD_PAT | BIND_PAT => true,
8829 _ => false,
8830 }
8831 }
8832 fn cast(syntax: SyntaxNode) -> Option<Self> {
8833 let res = match syntax.kind() {
8834 RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }),
8835 BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }),
8836 _ => return None,
8837 };
8838 Some(res)
8839 }
8840 fn syntax(&self) -> &SyntaxNode {
8841 match self {
8842 RecordInnerPat::RecordFieldPat(it) => &it.syntax,
8843 RecordInnerPat::BindPat(it) => &it.syntax,
8844 }
8845 }
8846}
8847#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7794pub enum AttrInput { 8848pub enum AttrInput {
7795 Literal(Literal), 8849 Literal(Literal),
7796 TokenTree(TokenTree), 8850 TokenTree(TokenTree),
@@ -7834,19 +8888,19 @@ impl AstNode for AttrInput {
7834} 8888}
7835#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8889#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7836pub enum Stmt { 8890pub enum Stmt {
7837 ExprStmt(ExprStmt),
7838 LetStmt(LetStmt), 8891 LetStmt(LetStmt),
7839} 8892 ExprStmt(ExprStmt),
7840impl From<ExprStmt> for Stmt {
7841 fn from(node: ExprStmt) -> Stmt {
7842 Stmt::ExprStmt(node)
7843 }
7844} 8893}
7845impl From<LetStmt> for Stmt { 8894impl From<LetStmt> for Stmt {
7846 fn from(node: LetStmt) -> Stmt { 8895 fn from(node: LetStmt) -> Stmt {
7847 Stmt::LetStmt(node) 8896 Stmt::LetStmt(node)
7848 } 8897 }
7849} 8898}
8899impl From<ExprStmt> for Stmt {
8900 fn from(node: ExprStmt) -> Stmt {
8901 Stmt::ExprStmt(node)
8902 }
8903}
7850impl std::fmt::Display for Stmt { 8904impl std::fmt::Display for Stmt {
7851 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 8905 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
7852 std::fmt::Display::fmt(self.syntax(), f) 8906 std::fmt::Display::fmt(self.syntax(), f)
@@ -7855,22 +8909,717 @@ impl std::fmt::Display for Stmt {
7855impl AstNode for Stmt { 8909impl AstNode for Stmt {
7856 fn can_cast(kind: SyntaxKind) -> bool { 8910 fn can_cast(kind: SyntaxKind) -> bool {
7857 match kind { 8911 match kind {
7858 EXPR_STMT | LET_STMT => true, 8912 LET_STMT | EXPR_STMT => true,
7859 _ => false, 8913 _ => false,
7860 } 8914 }
7861 } 8915 }
7862 fn cast(syntax: SyntaxNode) -> Option<Self> { 8916 fn cast(syntax: SyntaxNode) -> Option<Self> {
7863 let res = match syntax.kind() { 8917 let res = match syntax.kind() {
7864 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
7865 LET_STMT => Stmt::LetStmt(LetStmt { syntax }), 8918 LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
8919 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
7866 _ => return None, 8920 _ => return None,
7867 }; 8921 };
7868 Some(res) 8922 Some(res)
7869 } 8923 }
7870 fn syntax(&self) -> &SyntaxNode { 8924 fn syntax(&self) -> &SyntaxNode {
7871 match self { 8925 match self {
7872 Stmt::ExprStmt(it) => &it.syntax,
7873 Stmt::LetStmt(it) => &it.syntax, 8926 Stmt::LetStmt(it) => &it.syntax,
8927 Stmt::ExprStmt(it) => &it.syntax,
8928 }
8929 }
8930}
8931#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8932pub enum LeftDelimiter {
8933 LParen(LParen),
8934 LBrack(LBrack),
8935 LCurly(LCurly),
8936}
8937impl From<LParen> for LeftDelimiter {
8938 fn from(node: LParen) -> LeftDelimiter {
8939 LeftDelimiter::LParen(node)
8940 }
8941}
8942impl From<LBrack> for LeftDelimiter {
8943 fn from(node: LBrack) -> LeftDelimiter {
8944 LeftDelimiter::LBrack(node)
8945 }
8946}
8947impl From<LCurly> for LeftDelimiter {
8948 fn from(node: LCurly) -> LeftDelimiter {
8949 LeftDelimiter::LCurly(node)
8950 }
8951}
8952impl std::fmt::Display for LeftDelimiter {
8953 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
8954 std::fmt::Display::fmt(self.syntax(), f)
8955 }
8956}
8957impl AstToken for LeftDelimiter {
8958 fn can_cast(kind: SyntaxKind) -> bool {
8959 match kind {
8960 L_PAREN | L_BRACK | L_CURLY => true,
8961 _ => false,
8962 }
8963 }
8964 fn cast(syntax: SyntaxToken) -> Option<Self> {
8965 let res = match syntax.kind() {
8966 L_PAREN => LeftDelimiter::LParen(LParen { syntax }),
8967 L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }),
8968 L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }),
8969 _ => return None,
8970 };
8971 Some(res)
8972 }
8973 fn syntax(&self) -> &SyntaxToken {
8974 match self {
8975 LeftDelimiter::LParen(it) => &it.syntax,
8976 LeftDelimiter::LBrack(it) => &it.syntax,
8977 LeftDelimiter::LCurly(it) => &it.syntax,
8978 }
8979 }
8980}
8981#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8982pub enum RightDelimiter {
8983 RParen(RParen),
8984 RBrack(RBrack),
8985 RCurly(RCurly),
8986}
8987impl From<RParen> for RightDelimiter {
8988 fn from(node: RParen) -> RightDelimiter {
8989 RightDelimiter::RParen(node)
8990 }
8991}
8992impl From<RBrack> for RightDelimiter {
8993 fn from(node: RBrack) -> RightDelimiter {
8994 RightDelimiter::RBrack(node)
8995 }
8996}
8997impl From<RCurly> for RightDelimiter {
8998 fn from(node: RCurly) -> RightDelimiter {
8999 RightDelimiter::RCurly(node)
9000 }
9001}
9002impl std::fmt::Display for RightDelimiter {
9003 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9004 std::fmt::Display::fmt(self.syntax(), f)
9005 }
9006}
9007impl AstToken for RightDelimiter {
9008 fn can_cast(kind: SyntaxKind) -> bool {
9009 match kind {
9010 R_PAREN | R_BRACK | R_CURLY => true,
9011 _ => false,
9012 }
9013 }
9014 fn cast(syntax: SyntaxToken) -> Option<Self> {
9015 let res = match syntax.kind() {
9016 R_PAREN => RightDelimiter::RParen(RParen { syntax }),
9017 R_BRACK => RightDelimiter::RBrack(RBrack { syntax }),
9018 R_CURLY => RightDelimiter::RCurly(RCurly { syntax }),
9019 _ => return None,
9020 };
9021 Some(res)
9022 }
9023 fn syntax(&self) -> &SyntaxToken {
9024 match self {
9025 RightDelimiter::RParen(it) => &it.syntax,
9026 RightDelimiter::RBrack(it) => &it.syntax,
9027 RightDelimiter::RCurly(it) => &it.syntax,
9028 }
9029 }
9030}
9031#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9032pub enum RangeSeparator {
9033 Dotdot(Dotdot),
9034 Dotdotdot(Dotdotdot),
9035 Dotdoteq(Dotdoteq),
9036}
9037impl From<Dotdot> for RangeSeparator {
9038 fn from(node: Dotdot) -> RangeSeparator {
9039 RangeSeparator::Dotdot(node)
9040 }
9041}
9042impl From<Dotdotdot> for RangeSeparator {
9043 fn from(node: Dotdotdot) -> RangeSeparator {
9044 RangeSeparator::Dotdotdot(node)
9045 }
9046}
9047impl From<Dotdoteq> for RangeSeparator {
9048 fn from(node: Dotdoteq) -> RangeSeparator {
9049 RangeSeparator::Dotdoteq(node)
9050 }
9051}
9052impl std::fmt::Display for RangeSeparator {
9053 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9054 std::fmt::Display::fmt(self.syntax(), f)
9055 }
9056}
9057impl AstToken for RangeSeparator {
9058 fn can_cast(kind: SyntaxKind) -> bool {
9059 match kind {
9060 DOTDOT | DOTDOTDOT | DOTDOTEQ => true,
9061 _ => false,
9062 }
9063 }
9064 fn cast(syntax: SyntaxToken) -> Option<Self> {
9065 let res = match syntax.kind() {
9066 DOTDOT => RangeSeparator::Dotdot(Dotdot { syntax }),
9067 DOTDOTDOT => RangeSeparator::Dotdotdot(Dotdotdot { syntax }),
9068 DOTDOTEQ => RangeSeparator::Dotdoteq(Dotdoteq { syntax }),
9069 _ => return None,
9070 };
9071 Some(res)
9072 }
9073 fn syntax(&self) -> &SyntaxToken {
9074 match self {
9075 RangeSeparator::Dotdot(it) => &it.syntax,
9076 RangeSeparator::Dotdotdot(it) => &it.syntax,
9077 RangeSeparator::Dotdoteq(it) => &it.syntax,
9078 }
9079 }
9080}
9081#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9082pub enum BinOp {
9083 Pipepipe(Pipepipe),
9084 Ampamp(Ampamp),
9085 Eqeq(Eqeq),
9086 Neq(Neq),
9087 Lteq(Lteq),
9088 Gteq(Gteq),
9089 LAngle(LAngle),
9090 RAngle(RAngle),
9091 Plus(Plus),
9092 Star(Star),
9093 Minus(Minus),
9094 Slash(Slash),
9095 Percent(Percent),
9096 Shl(Shl),
9097 Shr(Shr),
9098 Caret(Caret),
9099 Pipe(Pipe),
9100 Amp(Amp),
9101 Eq(Eq),
9102 Pluseq(Pluseq),
9103 Slasheq(Slasheq),
9104 Stareq(Stareq),
9105 Percenteq(Percenteq),
9106 Shreq(Shreq),
9107 Shleq(Shleq),
9108 Minuseq(Minuseq),
9109 Pipeeq(Pipeeq),
9110 Ampeq(Ampeq),
9111 Careteq(Careteq),
9112}
9113impl From<Pipepipe> for BinOp {
9114 fn from(node: Pipepipe) -> BinOp {
9115 BinOp::Pipepipe(node)
9116 }
9117}
9118impl From<Ampamp> for BinOp {
9119 fn from(node: Ampamp) -> BinOp {
9120 BinOp::Ampamp(node)
9121 }
9122}
9123impl From<Eqeq> for BinOp {
9124 fn from(node: Eqeq) -> BinOp {
9125 BinOp::Eqeq(node)
9126 }
9127}
9128impl From<Neq> for BinOp {
9129 fn from(node: Neq) -> BinOp {
9130 BinOp::Neq(node)
9131 }
9132}
9133impl From<Lteq> for BinOp {
9134 fn from(node: Lteq) -> BinOp {
9135 BinOp::Lteq(node)
9136 }
9137}
9138impl From<Gteq> for BinOp {
9139 fn from(node: Gteq) -> BinOp {
9140 BinOp::Gteq(node)
9141 }
9142}
9143impl From<LAngle> for BinOp {
9144 fn from(node: LAngle) -> BinOp {
9145 BinOp::LAngle(node)
9146 }
9147}
9148impl From<RAngle> for BinOp {
9149 fn from(node: RAngle) -> BinOp {
9150 BinOp::RAngle(node)
9151 }
9152}
9153impl From<Plus> for BinOp {
9154 fn from(node: Plus) -> BinOp {
9155 BinOp::Plus(node)
9156 }
9157}
9158impl From<Star> for BinOp {
9159 fn from(node: Star) -> BinOp {
9160 BinOp::Star(node)
9161 }
9162}
9163impl From<Minus> for BinOp {
9164 fn from(node: Minus) -> BinOp {
9165 BinOp::Minus(node)
9166 }
9167}
9168impl From<Slash> for BinOp {
9169 fn from(node: Slash) -> BinOp {
9170 BinOp::Slash(node)
9171 }
9172}
9173impl From<Percent> for BinOp {
9174 fn from(node: Percent) -> BinOp {
9175 BinOp::Percent(node)
9176 }
9177}
9178impl From<Shl> for BinOp {
9179 fn from(node: Shl) -> BinOp {
9180 BinOp::Shl(node)
9181 }
9182}
9183impl From<Shr> for BinOp {
9184 fn from(node: Shr) -> BinOp {
9185 BinOp::Shr(node)
9186 }
9187}
9188impl From<Caret> for BinOp {
9189 fn from(node: Caret) -> BinOp {
9190 BinOp::Caret(node)
9191 }
9192}
9193impl From<Pipe> for BinOp {
9194 fn from(node: Pipe) -> BinOp {
9195 BinOp::Pipe(node)
9196 }
9197}
9198impl From<Amp> for BinOp {
9199 fn from(node: Amp) -> BinOp {
9200 BinOp::Amp(node)
9201 }
9202}
9203impl From<Eq> for BinOp {
9204 fn from(node: Eq) -> BinOp {
9205 BinOp::Eq(node)
9206 }
9207}
9208impl From<Pluseq> for BinOp {
9209 fn from(node: Pluseq) -> BinOp {
9210 BinOp::Pluseq(node)
9211 }
9212}
9213impl From<Slasheq> for BinOp {
9214 fn from(node: Slasheq) -> BinOp {
9215 BinOp::Slasheq(node)
9216 }
9217}
9218impl From<Stareq> for BinOp {
9219 fn from(node: Stareq) -> BinOp {
9220 BinOp::Stareq(node)
9221 }
9222}
9223impl From<Percenteq> for BinOp {
9224 fn from(node: Percenteq) -> BinOp {
9225 BinOp::Percenteq(node)
9226 }
9227}
9228impl From<Shreq> for BinOp {
9229 fn from(node: Shreq) -> BinOp {
9230 BinOp::Shreq(node)
9231 }
9232}
9233impl From<Shleq> for BinOp {
9234 fn from(node: Shleq) -> BinOp {
9235 BinOp::Shleq(node)
9236 }
9237}
9238impl From<Minuseq> for BinOp {
9239 fn from(node: Minuseq) -> BinOp {
9240 BinOp::Minuseq(node)
9241 }
9242}
9243impl From<Pipeeq> for BinOp {
9244 fn from(node: Pipeeq) -> BinOp {
9245 BinOp::Pipeeq(node)
9246 }
9247}
9248impl From<Ampeq> for BinOp {
9249 fn from(node: Ampeq) -> BinOp {
9250 BinOp::Ampeq(node)
9251 }
9252}
9253impl From<Careteq> for BinOp {
9254 fn from(node: Careteq) -> BinOp {
9255 BinOp::Careteq(node)
9256 }
9257}
9258impl std::fmt::Display for BinOp {
9259 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9260 std::fmt::Display::fmt(self.syntax(), f)
9261 }
9262}
9263impl AstToken for BinOp {
9264 fn can_cast(kind: SyntaxKind) -> bool {
9265 match kind {
9266 PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR
9267 | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ
9268 | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true,
9269 _ => false,
9270 }
9271 }
9272 fn cast(syntax: SyntaxToken) -> Option<Self> {
9273 let res = match syntax.kind() {
9274 PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }),
9275 AMPAMP => BinOp::Ampamp(Ampamp { syntax }),
9276 EQEQ => BinOp::Eqeq(Eqeq { syntax }),
9277 NEQ => BinOp::Neq(Neq { syntax }),
9278 LTEQ => BinOp::Lteq(Lteq { syntax }),
9279 GTEQ => BinOp::Gteq(Gteq { syntax }),
9280 L_ANGLE => BinOp::LAngle(LAngle { syntax }),
9281 R_ANGLE => BinOp::RAngle(RAngle { syntax }),
9282 PLUS => BinOp::Plus(Plus { syntax }),
9283 STAR => BinOp::Star(Star { syntax }),
9284 MINUS => BinOp::Minus(Minus { syntax }),
9285 SLASH => BinOp::Slash(Slash { syntax }),
9286 PERCENT => BinOp::Percent(Percent { syntax }),
9287 SHL => BinOp::Shl(Shl { syntax }),
9288 SHR => BinOp::Shr(Shr { syntax }),
9289 CARET => BinOp::Caret(Caret { syntax }),
9290 PIPE => BinOp::Pipe(Pipe { syntax }),
9291 AMP => BinOp::Amp(Amp { syntax }),
9292 EQ => BinOp::Eq(Eq { syntax }),
9293 PLUSEQ => BinOp::Pluseq(Pluseq { syntax }),
9294 SLASHEQ => BinOp::Slasheq(Slasheq { syntax }),
9295 STAREQ => BinOp::Stareq(Stareq { syntax }),
9296 PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }),
9297 SHREQ => BinOp::Shreq(Shreq { syntax }),
9298 SHLEQ => BinOp::Shleq(Shleq { syntax }),
9299 MINUSEQ => BinOp::Minuseq(Minuseq { syntax }),
9300 PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }),
9301 AMPEQ => BinOp::Ampeq(Ampeq { syntax }),
9302 CARETEQ => BinOp::Careteq(Careteq { syntax }),
9303 _ => return None,
9304 };
9305 Some(res)
9306 }
9307 fn syntax(&self) -> &SyntaxToken {
9308 match self {
9309 BinOp::Pipepipe(it) => &it.syntax,
9310 BinOp::Ampamp(it) => &it.syntax,
9311 BinOp::Eqeq(it) => &it.syntax,
9312 BinOp::Neq(it) => &it.syntax,
9313 BinOp::Lteq(it) => &it.syntax,
9314 BinOp::Gteq(it) => &it.syntax,
9315 BinOp::LAngle(it) => &it.syntax,
9316 BinOp::RAngle(it) => &it.syntax,
9317 BinOp::Plus(it) => &it.syntax,
9318 BinOp::Star(it) => &it.syntax,
9319 BinOp::Minus(it) => &it.syntax,
9320 BinOp::Slash(it) => &it.syntax,
9321 BinOp::Percent(it) => &it.syntax,
9322 BinOp::Shl(it) => &it.syntax,
9323 BinOp::Shr(it) => &it.syntax,
9324 BinOp::Caret(it) => &it.syntax,
9325 BinOp::Pipe(it) => &it.syntax,
9326 BinOp::Amp(it) => &it.syntax,
9327 BinOp::Eq(it) => &it.syntax,
9328 BinOp::Pluseq(it) => &it.syntax,
9329 BinOp::Slasheq(it) => &it.syntax,
9330 BinOp::Stareq(it) => &it.syntax,
9331 BinOp::Percenteq(it) => &it.syntax,
9332 BinOp::Shreq(it) => &it.syntax,
9333 BinOp::Shleq(it) => &it.syntax,
9334 BinOp::Minuseq(it) => &it.syntax,
9335 BinOp::Pipeeq(it) => &it.syntax,
9336 BinOp::Ampeq(it) => &it.syntax,
9337 BinOp::Careteq(it) => &it.syntax,
9338 }
9339 }
9340}
9341#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9342pub enum PrefixOp {
9343 Minus(Minus),
9344 Excl(Excl),
9345 Star(Star),
9346}
9347impl From<Minus> for PrefixOp {
9348 fn from(node: Minus) -> PrefixOp {
9349 PrefixOp::Minus(node)
9350 }
9351}
9352impl From<Excl> for PrefixOp {
9353 fn from(node: Excl) -> PrefixOp {
9354 PrefixOp::Excl(node)
9355 }
9356}
9357impl From<Star> for PrefixOp {
9358 fn from(node: Star) -> PrefixOp {
9359 PrefixOp::Star(node)
9360 }
9361}
9362impl std::fmt::Display for PrefixOp {
9363 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9364 std::fmt::Display::fmt(self.syntax(), f)
9365 }
9366}
9367impl AstToken for PrefixOp {
9368 fn can_cast(kind: SyntaxKind) -> bool {
9369 match kind {
9370 MINUS | EXCL | STAR => true,
9371 _ => false,
9372 }
9373 }
9374 fn cast(syntax: SyntaxToken) -> Option<Self> {
9375 let res = match syntax.kind() {
9376 MINUS => PrefixOp::Minus(Minus { syntax }),
9377 EXCL => PrefixOp::Excl(Excl { syntax }),
9378 STAR => PrefixOp::Star(Star { syntax }),
9379 _ => return None,
9380 };
9381 Some(res)
9382 }
9383 fn syntax(&self) -> &SyntaxToken {
9384 match self {
9385 PrefixOp::Minus(it) => &it.syntax,
9386 PrefixOp::Excl(it) => &it.syntax,
9387 PrefixOp::Star(it) => &it.syntax,
9388 }
9389 }
9390}
9391#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9392pub enum RangeOp {
9393 Dotdot(Dotdot),
9394 Dotdoteq(Dotdoteq),
9395}
9396impl From<Dotdot> for RangeOp {
9397 fn from(node: Dotdot) -> RangeOp {
9398 RangeOp::Dotdot(node)
9399 }
9400}
9401impl From<Dotdoteq> for RangeOp {
9402 fn from(node: Dotdoteq) -> RangeOp {
9403 RangeOp::Dotdoteq(node)
9404 }
9405}
9406impl std::fmt::Display for RangeOp {
9407 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9408 std::fmt::Display::fmt(self.syntax(), f)
9409 }
9410}
9411impl AstToken for RangeOp {
9412 fn can_cast(kind: SyntaxKind) -> bool {
9413 match kind {
9414 DOTDOT | DOTDOTEQ => true,
9415 _ => false,
9416 }
9417 }
9418 fn cast(syntax: SyntaxToken) -> Option<Self> {
9419 let res = match syntax.kind() {
9420 DOTDOT => RangeOp::Dotdot(Dotdot { syntax }),
9421 DOTDOTEQ => RangeOp::Dotdoteq(Dotdoteq { syntax }),
9422 _ => return None,
9423 };
9424 Some(res)
9425 }
9426 fn syntax(&self) -> &SyntaxToken {
9427 match self {
9428 RangeOp::Dotdot(it) => &it.syntax,
9429 RangeOp::Dotdoteq(it) => &it.syntax,
9430 }
9431 }
9432}
9433#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9434pub enum LiteralToken {
9435 IntNumber(IntNumber),
9436 FloatNumber(FloatNumber),
9437 String(String),
9438 RawString(RawString),
9439 TrueKw(TrueKw),
9440 FalseKw(FalseKw),
9441 ByteString(ByteString),
9442 RawByteString(RawByteString),
9443 Char(Char),
9444 Byte(Byte),
9445}
9446impl From<IntNumber> for LiteralToken {
9447 fn from(node: IntNumber) -> LiteralToken {
9448 LiteralToken::IntNumber(node)
9449 }
9450}
9451impl From<FloatNumber> for LiteralToken {
9452 fn from(node: FloatNumber) -> LiteralToken {
9453 LiteralToken::FloatNumber(node)
9454 }
9455}
9456impl From<String> for LiteralToken {
9457 fn from(node: String) -> LiteralToken {
9458 LiteralToken::String(node)
9459 }
9460}
9461impl From<RawString> for LiteralToken {
9462 fn from(node: RawString) -> LiteralToken {
9463 LiteralToken::RawString(node)
9464 }
9465}
9466impl From<TrueKw> for LiteralToken {
9467 fn from(node: TrueKw) -> LiteralToken {
9468 LiteralToken::TrueKw(node)
9469 }
9470}
9471impl From<FalseKw> for LiteralToken {
9472 fn from(node: FalseKw) -> LiteralToken {
9473 LiteralToken::FalseKw(node)
9474 }
9475}
9476impl From<ByteString> for LiteralToken {
9477 fn from(node: ByteString) -> LiteralToken {
9478 LiteralToken::ByteString(node)
9479 }
9480}
9481impl From<RawByteString> for LiteralToken {
9482 fn from(node: RawByteString) -> LiteralToken {
9483 LiteralToken::RawByteString(node)
9484 }
9485}
9486impl From<Char> for LiteralToken {
9487 fn from(node: Char) -> LiteralToken {
9488 LiteralToken::Char(node)
9489 }
9490}
9491impl From<Byte> for LiteralToken {
9492 fn from(node: Byte) -> LiteralToken {
9493 LiteralToken::Byte(node)
9494 }
9495}
9496impl std::fmt::Display for LiteralToken {
9497 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9498 std::fmt::Display::fmt(self.syntax(), f)
9499 }
9500}
9501impl AstToken for LiteralToken {
9502 fn can_cast(kind: SyntaxKind) -> bool {
9503 match kind {
9504 INT_NUMBER | FLOAT_NUMBER | STRING | RAW_STRING | TRUE_KW | FALSE_KW | BYTE_STRING
9505 | RAW_BYTE_STRING | CHAR | BYTE => true,
9506 _ => false,
9507 }
9508 }
9509 fn cast(syntax: SyntaxToken) -> Option<Self> {
9510 let res = match syntax.kind() {
9511 INT_NUMBER => LiteralToken::IntNumber(IntNumber { syntax }),
9512 FLOAT_NUMBER => LiteralToken::FloatNumber(FloatNumber { syntax }),
9513 STRING => LiteralToken::String(String { syntax }),
9514 RAW_STRING => LiteralToken::RawString(RawString { syntax }),
9515 TRUE_KW => LiteralToken::TrueKw(TrueKw { syntax }),
9516 FALSE_KW => LiteralToken::FalseKw(FalseKw { syntax }),
9517 BYTE_STRING => LiteralToken::ByteString(ByteString { syntax }),
9518 RAW_BYTE_STRING => LiteralToken::RawByteString(RawByteString { syntax }),
9519 CHAR => LiteralToken::Char(Char { syntax }),
9520 BYTE => LiteralToken::Byte(Byte { syntax }),
9521 _ => return None,
9522 };
9523 Some(res)
9524 }
9525 fn syntax(&self) -> &SyntaxToken {
9526 match self {
9527 LiteralToken::IntNumber(it) => &it.syntax,
9528 LiteralToken::FloatNumber(it) => &it.syntax,
9529 LiteralToken::String(it) => &it.syntax,
9530 LiteralToken::RawString(it) => &it.syntax,
9531 LiteralToken::TrueKw(it) => &it.syntax,
9532 LiteralToken::FalseKw(it) => &it.syntax,
9533 LiteralToken::ByteString(it) => &it.syntax,
9534 LiteralToken::RawByteString(it) => &it.syntax,
9535 LiteralToken::Char(it) => &it.syntax,
9536 LiteralToken::Byte(it) => &it.syntax,
9537 }
9538 }
9539}
9540#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9541pub enum NameRefToken {
9542 Ident(Ident),
9543 IntNumber(IntNumber),
9544}
9545impl From<Ident> for NameRefToken {
9546 fn from(node: Ident) -> NameRefToken {
9547 NameRefToken::Ident(node)
9548 }
9549}
9550impl From<IntNumber> for NameRefToken {
9551 fn from(node: IntNumber) -> NameRefToken {
9552 NameRefToken::IntNumber(node)
9553 }
9554}
9555impl std::fmt::Display for NameRefToken {
9556 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9557 std::fmt::Display::fmt(self.syntax(), f)
9558 }
9559}
9560impl AstToken for NameRefToken {
9561 fn can_cast(kind: SyntaxKind) -> bool {
9562 match kind {
9563 IDENT | INT_NUMBER => true,
9564 _ => false,
9565 }
9566 }
9567 fn cast(syntax: SyntaxToken) -> Option<Self> {
9568 let res = match syntax.kind() {
9569 IDENT => NameRefToken::Ident(Ident { syntax }),
9570 INT_NUMBER => NameRefToken::IntNumber(IntNumber { syntax }),
9571 _ => return None,
9572 };
9573 Some(res)
9574 }
9575 fn syntax(&self) -> &SyntaxToken {
9576 match self {
9577 NameRefToken::Ident(it) => &it.syntax,
9578 NameRefToken::IntNumber(it) => &it.syntax,
9579 }
9580 }
9581}
9582#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9583pub enum FieldDefList {
9584 RecordFieldDefList(RecordFieldDefList),
9585 TupleFieldDefList(TupleFieldDefList),
9586}
9587impl From<RecordFieldDefList> for FieldDefList {
9588 fn from(node: RecordFieldDefList) -> FieldDefList {
9589 FieldDefList::RecordFieldDefList(node)
9590 }
9591}
9592impl From<TupleFieldDefList> for FieldDefList {
9593 fn from(node: TupleFieldDefList) -> FieldDefList {
9594 FieldDefList::TupleFieldDefList(node)
9595 }
9596}
9597impl std::fmt::Display for FieldDefList {
9598 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
9599 std::fmt::Display::fmt(self.syntax(), f)
9600 }
9601}
9602impl AstNode for FieldDefList {
9603 fn can_cast(kind: SyntaxKind) -> bool {
9604 match kind {
9605 RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true,
9606 _ => false,
9607 }
9608 }
9609 fn cast(syntax: SyntaxNode) -> Option<Self> {
9610 let res = match syntax.kind() {
9611 RECORD_FIELD_DEF_LIST => {
9612 FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax })
9613 }
9614 TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
9615 _ => return None,
9616 };
9617 Some(res)
9618 }
9619 fn syntax(&self) -> &SyntaxNode {
9620 match self {
9621 FieldDefList::RecordFieldDefList(it) => &it.syntax,
9622 FieldDefList::TupleFieldDefList(it) => &it.syntax,
7874 } 9623 }
7875 } 9624 }
7876} 9625}
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index 576378306..870e83804 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -5,7 +5,7 @@
5use itertools::Itertools; 5use itertools::Itertools;
6 6
7use crate::{ 7use crate::{
8 ast::{self, child_opt, children, AstChildren, AstNode, AstToken}, 8 ast::{self, child_opt, children, support, AstChildren, AstNode, AstToken},
9 syntax_node::SyntaxElementChildren, 9 syntax_node::SyntaxElementChildren,
10}; 10};
11 11
@@ -31,6 +31,10 @@ pub trait LoopBodyOwner: AstNode {
31 fn loop_body(&self) -> Option<ast::BlockExpr> { 31 fn loop_body(&self) -> Option<ast::BlockExpr> {
32 child_opt(self) 32 child_opt(self)
33 } 33 }
34
35 fn label(&self) -> Option<ast::Label> {
36 child_opt(self)
37 }
34} 38}
35 39
36pub trait ArgListOwner: AstNode { 40pub trait ArgListOwner: AstNode {
@@ -65,6 +69,10 @@ pub trait TypeBoundsOwner: AstNode {
65 fn type_bound_list(&self) -> Option<ast::TypeBoundList> { 69 fn type_bound_list(&self) -> Option<ast::TypeBoundList> {
66 child_opt(self) 70 child_opt(self)
67 } 71 }
72
73 fn colon(&self) -> Option<ast::Colon> {
74 support::token(self.syntax())
75 }
68} 76}
69 77
70pub trait AttrsOwner: AstNode { 78pub trait AttrsOwner: AstNode {