From 14cb96ec0e6be3b99bfe4ea373c058dcbd2a4f79 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 19:54:16 +0200 Subject: Allign RecordPat with RecordExpr --- crates/ra_syntax/src/ast/generated/nodes.rs | 29 +++++++++++++---------------- crates/ra_syntax/src/ast/node_ext.rs | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 66821a31c..7708ae806 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -1192,7 +1192,7 @@ pub struct RecordPat { } impl RecordPat { pub fn path(&self) -> Option { support::child(&self.syntax) } - pub fn record_field_pat_list(&self) -> Option { + pub fn record_pat_field_list(&self) -> Option { support::child(&self.syntax) } } @@ -1234,24 +1234,21 @@ impl TupleStructPat { pub fn r_paren_token(&self) -> Option { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldPatList { +pub struct RecordPatFieldList { pub(crate) syntax: SyntaxNode, } -impl RecordFieldPatList { +impl RecordPatFieldList { pub fn l_curly_token(&self) -> Option { support::token(&self.syntax, T!['{']) } - pub fn record_field_pats(&self) -> AstChildren { - support::children(&self.syntax) - } - pub fn bind_pats(&self) -> AstChildren { support::children(&self.syntax) } + pub fn fields(&self) -> AstChildren { support::children(&self.syntax) } pub fn dotdot_token(&self) -> Option { support::token(&self.syntax, T![..]) } pub fn r_curly_token(&self) -> Option { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldPat { +pub struct RecordPatField { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for RecordFieldPat {} -impl RecordFieldPat { +impl ast::AttrsOwner for RecordPatField {} +impl RecordPatField { pub fn name_ref(&self) -> Option { support::child(&self.syntax) } pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } pub fn pat(&self) -> Option { support::child(&self.syntax) } @@ -2724,8 +2721,8 @@ impl AstNode for TupleStructPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldPatList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } +impl AstNode for RecordPatFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2735,8 +2732,8 @@ impl AstNode for RecordFieldPatList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } +impl AstNode for RecordPatField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -4059,12 +4056,12 @@ impl std::fmt::Display for TupleStructPat { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldPatList { +impl std::fmt::Display for RecordPatFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldPat { +impl std::fmt::Display for RecordPatField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 69726fb93..2cfdac225 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -227,7 +227,7 @@ impl fmt::Display for NameOrNameRef { } } -impl ast::RecordFieldPat { +impl ast::RecordPatField { /// Deals with field init shorthand pub fn field_name(&self) -> Option { if let Some(name_ref) = self.name_ref() { -- cgit v1.2.3