diff options
Diffstat (limited to 'crates/syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/syntax/src/ast/generated/nodes.rs | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 9a88fdb56..702de59a9 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs | |||
@@ -150,10 +150,7 @@ impl Attr { | |||
150 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } | 150 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } |
151 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 151 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
152 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 152 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
153 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 153 | pub fn meta(&self) -> Option<Meta> { support::child(&self.syntax) } |
154 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
155 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
156 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
157 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 154 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
158 | } | 155 | } |
159 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 156 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -632,6 +629,16 @@ impl WherePred { | |||
632 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 629 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
633 | } | 630 | } |
634 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
632 | pub struct Meta { | ||
633 | pub(crate) syntax: SyntaxNode, | ||
634 | } | ||
635 | impl Meta { | ||
636 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
637 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
638 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
639 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
640 | } | ||
641 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
635 | pub struct ExprStmt { | 642 | pub struct ExprStmt { |
636 | pub(crate) syntax: SyntaxNode, | 643 | pub(crate) syntax: SyntaxNode, |
637 | } | 644 | } |
@@ -2072,6 +2079,17 @@ impl AstNode for WherePred { | |||
2072 | } | 2079 | } |
2073 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2080 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2074 | } | 2081 | } |
2082 | impl AstNode for Meta { | ||
2083 | fn can_cast(kind: SyntaxKind) -> bool { kind == META } | ||
2084 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2085 | if Self::can_cast(syntax.kind()) { | ||
2086 | Some(Self { syntax }) | ||
2087 | } else { | ||
2088 | None | ||
2089 | } | ||
2090 | } | ||
2091 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2092 | } | ||
2075 | impl AstNode for ExprStmt { | 2093 | impl AstNode for ExprStmt { |
2076 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } | 2094 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } |
2077 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2095 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3887,6 +3905,11 @@ impl std::fmt::Display for WherePred { | |||
3887 | std::fmt::Display::fmt(self.syntax(), f) | 3905 | std::fmt::Display::fmt(self.syntax(), f) |
3888 | } | 3906 | } |
3889 | } | 3907 | } |
3908 | impl std::fmt::Display for Meta { | ||
3909 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3910 | std::fmt::Display::fmt(self.syntax(), f) | ||
3911 | } | ||
3912 | } | ||
3890 | impl std::fmt::Display for ExprStmt { | 3913 | impl std::fmt::Display for ExprStmt { |
3891 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3914 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3892 | std::fmt::Display::fmt(self.syntax(), f) | 3915 | std::fmt::Display::fmt(self.syntax(), f) |