Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/generated/nodes.rs')
| -rw-r--r-- | crates/syntax/src/ast/generated/nodes.rs | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 6c1dcf336a..7b9f5b9166 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs @@ -639,10 +639,16 @@ impl ForType { pub struct FormatArgsArg { pub(crate) syntax: SyntaxNode, } -impl ast::HasName for FormatArgsArg {} impl FormatArgsArg { #[inline] + pub fn arg_name(&self) -> Option<FormatArgsArgName> { support::child(&self.syntax) } + #[inline] pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +} +pub struct FormatArgsArgName { + pub(crate) syntax: SyntaxNode, +} +impl FormatArgsArgName { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } @@ -3722,6 +3728,38 @@ impl fmt::Debug for FormatArgsArg { f.debug_struct("FormatArgsArg").field("syntax", &self.syntax).finish() } } +impl AstNode for FormatArgsArgName { + #[inline] + fn kind() -> SyntaxKind + where + Self: Sized, + { + FORMAT_ARGS_ARG_NAME + } + #[inline] + fn can_cast(kind: SyntaxKind) -> bool { kind == FORMAT_ARGS_ARG_NAME } + #[inline] + fn cast(syntax: SyntaxNode) -> Option<Self> { + if Self::can_cast(syntax.kind()) { Some(Self { syntax }) } else { None } + } + #[inline] + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} +impl hash::Hash for FormatArgsArgName { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FormatArgsArgName {} +impl PartialEq for FormatArgsArgName { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for FormatArgsArgName { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for FormatArgsArgName { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FormatArgsArgName").field("syntax", &self.syntax).finish() + } +} impl AstNode for FormatArgsExpr { #[inline] fn kind() -> SyntaxKind @@ -8947,7 +8985,6 @@ impl AstNode for AnyHasName { | CONST_PARAM | ENUM | FN - | FORMAT_ARGS_ARG | IDENT_PAT | MACRO_DEF | MACRO_RULES @@ -9006,10 +9043,6 @@ impl From<Fn> for AnyHasName { #[inline] fn from(node: Fn) -> AnyHasName { AnyHasName { syntax: node.syntax } } } -impl From<FormatArgsArg> for AnyHasName { - #[inline] - fn from(node: FormatArgsArg) -> AnyHasName { AnyHasName { syntax: node.syntax } } -} impl From<IdentPat> for AnyHasName { #[inline] fn from(node: IdentPat) -> AnyHasName { AnyHasName { syntax: node.syntax } } @@ -9541,6 +9574,11 @@ impl std::fmt::Display for FormatArgsArg { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for FormatArgsArgName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for FormatArgsExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) |