aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast/generated
diff options
context:
space:
mode:
Diffstat (limited to 'crates/syntax/src/ast/generated')
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs62
1 files changed, 35 insertions, 27 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
index 6eae323f4..1588ba93e 100644
--- a/crates/syntax/src/ast/generated/nodes.rs
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -20,6 +20,15 @@ impl NameRef {
20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } 20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
21} 21}
22#[derive(Debug, Clone, PartialEq, Eq, Hash)] 22#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Lifetime {
24 pub(crate) syntax: SyntaxNode,
25}
26impl Lifetime {
27 pub fn lifetime_ident_token(&self) -> Option<SyntaxToken> {
28 support::token(&self.syntax, T![lifetime_ident])
29 }
30}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Path { 32pub struct Path {
24 pub(crate) syntax: SyntaxNode, 33 pub(crate) syntax: SyntaxNode,
25} 34}
@@ -105,9 +114,7 @@ pub struct LifetimeArg {
105 pub(crate) syntax: SyntaxNode, 114 pub(crate) syntax: SyntaxNode,
106} 115}
107impl LifetimeArg { 116impl LifetimeArg {
108 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 117 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
109 support::token(&self.syntax, T![lifetime])
110 }
111} 118}
112#[derive(Debug, Clone, PartialEq, Eq, Hash)] 119#[derive(Debug, Clone, PartialEq, Eq, Hash)]
113pub struct ConstArg { 120pub struct ConstArg {
@@ -487,9 +494,7 @@ pub struct SelfParam {
487impl ast::AttrsOwner for SelfParam {} 494impl ast::AttrsOwner for SelfParam {}
488impl SelfParam { 495impl SelfParam {
489 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 496 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
490 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 497 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
491 support::token(&self.syntax, T![lifetime])
492 }
493 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 498 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
494 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 499 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
495 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 500 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
@@ -605,9 +610,7 @@ pub struct LifetimeParam {
605impl ast::AttrsOwner for LifetimeParam {} 610impl ast::AttrsOwner for LifetimeParam {}
606impl ast::TypeBoundsOwner for LifetimeParam {} 611impl ast::TypeBoundsOwner for LifetimeParam {}
607impl LifetimeParam { 612impl LifetimeParam {
608 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 613 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
609 support::token(&self.syntax, T![lifetime])
610 }
611} 614}
612#[derive(Debug, Clone, PartialEq, Eq, Hash)] 615#[derive(Debug, Clone, PartialEq, Eq, Hash)]
613pub struct TypeParam { 616pub struct TypeParam {
@@ -628,9 +631,7 @@ impl ast::TypeBoundsOwner for WherePred {}
628impl WherePred { 631impl WherePred {
629 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 632 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
630 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } 633 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
631 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 634 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
632 support::token(&self.syntax, T![lifetime])
633 }
634 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 635 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
635} 636}
636#[derive(Debug, Clone, PartialEq, Eq, Hash)] 637#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -706,9 +707,7 @@ pub struct BreakExpr {
706impl ast::AttrsOwner for BreakExpr {} 707impl ast::AttrsOwner for BreakExpr {}
707impl BreakExpr { 708impl BreakExpr {
708 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } 709 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
709 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 710 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
710 support::token(&self.syntax, T![lifetime])
711 }
712 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 711 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
713} 712}
714#[derive(Debug, Clone, PartialEq, Eq, Hash)] 713#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -752,9 +751,7 @@ impl ContinueExpr {
752 pub fn continue_token(&self) -> Option<SyntaxToken> { 751 pub fn continue_token(&self) -> Option<SyntaxToken> {
753 support::token(&self.syntax, T![continue]) 752 support::token(&self.syntax, T![continue])
754 } 753 }
755 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 754 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
756 support::token(&self.syntax, T![lifetime])
757 }
758} 755}
759#[derive(Debug, Clone, PartialEq, Eq, Hash)] 756#[derive(Debug, Clone, PartialEq, Eq, Hash)]
760pub struct EffectExpr { 757pub struct EffectExpr {
@@ -937,9 +934,8 @@ pub struct Label {
937 pub(crate) syntax: SyntaxNode, 934 pub(crate) syntax: SyntaxNode,
938} 935}
939impl Label { 936impl Label {
940 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 937 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
941 support::token(&self.syntax, T![lifetime]) 938 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
942 }
943} 939}
944#[derive(Debug, Clone, PartialEq, Eq, Hash)] 940#[derive(Debug, Clone, PartialEq, Eq, Hash)]
945pub struct RecordExprFieldList { 941pub struct RecordExprFieldList {
@@ -1100,9 +1096,7 @@ pub struct RefType {
1100} 1096}
1101impl RefType { 1097impl RefType {
1102 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 1098 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1103 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1099 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
1104 support::token(&self.syntax, T![lifetime])
1105 }
1106 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 1100 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1107 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 1101 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1108} 1102}
@@ -1129,9 +1123,7 @@ pub struct TypeBound {
1129 pub(crate) syntax: SyntaxNode, 1123 pub(crate) syntax: SyntaxNode,
1130} 1124}
1131impl TypeBound { 1125impl TypeBound {
1132 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1126 pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) }
1133 support::token(&self.syntax, T![lifetime])
1134 }
1135 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } 1127 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1136 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 1128 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1137} 1129}
@@ -1438,6 +1430,17 @@ impl AstNode for NameRef {
1438 } 1430 }
1439 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1431 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1440} 1432}
1433impl AstNode for Lifetime {
1434 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME }
1435 fn cast(syntax: SyntaxNode) -> Option<Self> {
1436 if Self::can_cast(syntax.kind()) {
1437 Some(Self { syntax })
1438 } else {
1439 None
1440 }
1441 }
1442 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1443}
1441impl AstNode for Path { 1444impl AstNode for Path {
1442 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } 1445 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1443 fn cast(syntax: SyntaxNode) -> Option<Self> { 1446 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -3524,6 +3527,11 @@ impl std::fmt::Display for NameRef {
3524 std::fmt::Display::fmt(self.syntax(), f) 3527 std::fmt::Display::fmt(self.syntax(), f)
3525 } 3528 }
3526} 3529}
3530impl std::fmt::Display for Lifetime {
3531 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3532 std::fmt::Display::fmt(self.syntax(), f)
3533 }
3534}
3527impl std::fmt::Display for Path { 3535impl std::fmt::Display for Path {
3528 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3536 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3529 std::fmt::Display::fmt(self.syntax(), f) 3537 std::fmt::Display::fmt(self.syntax(), f)