aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-31 18:54:16 +0100
committerAleksey Kladov <[email protected]>2020-07-31 19:00:48 +0100
commit14cb96ec0e6be3b99bfe4ea373c058dcbd2a4f79 (patch)
tree730802ad5c2d522bd77eba81984d8e368e852948 /crates/ra_syntax/src/ast
parent572f1c08b6ba43bdd57c5cb99f79a08ecd821c1c (diff)
Allign RecordPat with RecordExpr
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs29
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
2 files changed, 14 insertions, 17 deletions
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 {
1192} 1192}
1193impl RecordPat { 1193impl RecordPat {
1194 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1194 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1195 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { 1195 pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> {
1196 support::child(&self.syntax) 1196 support::child(&self.syntax)
1197 } 1197 }
1198} 1198}
@@ -1234,24 +1234,21 @@ impl TupleStructPat {
1234 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1234 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1235} 1235}
1236#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1236#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1237pub struct RecordFieldPatList { 1237pub struct RecordPatFieldList {
1238 pub(crate) syntax: SyntaxNode, 1238 pub(crate) syntax: SyntaxNode,
1239} 1239}
1240impl RecordFieldPatList { 1240impl RecordPatFieldList {
1241 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 1241 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1242 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { 1242 pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) }
1243 support::children(&self.syntax)
1244 }
1245 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1246 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1243 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1247 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 1244 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1248} 1245}
1249#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1246#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1250pub struct RecordFieldPat { 1247pub struct RecordPatField {
1251 pub(crate) syntax: SyntaxNode, 1248 pub(crate) syntax: SyntaxNode,
1252} 1249}
1253impl ast::AttrsOwner for RecordFieldPat {} 1250impl ast::AttrsOwner for RecordPatField {}
1254impl RecordFieldPat { 1251impl RecordPatField {
1255 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1252 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1256 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 1253 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1257 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1254 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
@@ -2724,8 +2721,8 @@ impl AstNode for TupleStructPat {
2724 } 2721 }
2725 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2722 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2726} 2723}
2727impl AstNode for RecordFieldPatList { 2724impl AstNode for RecordPatFieldList {
2728 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } 2725 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST }
2729 fn cast(syntax: SyntaxNode) -> Option<Self> { 2726 fn cast(syntax: SyntaxNode) -> Option<Self> {
2730 if Self::can_cast(syntax.kind()) { 2727 if Self::can_cast(syntax.kind()) {
2731 Some(Self { syntax }) 2728 Some(Self { syntax })
@@ -2735,8 +2732,8 @@ impl AstNode for RecordFieldPatList {
2735 } 2732 }
2736 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2733 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2737} 2734}
2738impl AstNode for RecordFieldPat { 2735impl AstNode for RecordPatField {
2739 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } 2736 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD }
2740 fn cast(syntax: SyntaxNode) -> Option<Self> { 2737 fn cast(syntax: SyntaxNode) -> Option<Self> {
2741 if Self::can_cast(syntax.kind()) { 2738 if Self::can_cast(syntax.kind()) {
2742 Some(Self { syntax }) 2739 Some(Self { syntax })
@@ -4059,12 +4056,12 @@ impl std::fmt::Display for TupleStructPat {
4059 std::fmt::Display::fmt(self.syntax(), f) 4056 std::fmt::Display::fmt(self.syntax(), f)
4060 } 4057 }
4061} 4058}
4062impl std::fmt::Display for RecordFieldPatList { 4059impl std::fmt::Display for RecordPatFieldList {
4063 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4060 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4064 std::fmt::Display::fmt(self.syntax(), f) 4061 std::fmt::Display::fmt(self.syntax(), f)
4065 } 4062 }
4066} 4063}
4067impl std::fmt::Display for RecordFieldPat { 4064impl std::fmt::Display for RecordPatField {
4068 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4065 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4069 std::fmt::Display::fmt(self.syntax(), f) 4066 std::fmt::Display::fmt(self.syntax(), f)
4070 } 4067 }
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 {
227 } 227 }
228} 228}
229 229
230impl ast::RecordFieldPat { 230impl ast::RecordPatField {
231 /// Deals with field init shorthand 231 /// Deals with field init shorthand
232 pub fn field_name(&self) -> Option<NameOrNameRef> { 232 pub fn field_name(&self) -> Option<NameOrNameRef> {
233 if let Some(name_ref) = self.name_ref() { 233 if let Some(name_ref) = self.name_ref() {