aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs29
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast6
8 files changed, 36 insertions, 39 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() {
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
index 3ce2acfae..d848f3c88 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast
@@ -58,7 +58,7 @@ [email protected]
58 [email protected] 58 [email protected]
59 [email protected] "Bar" 59 [email protected] "Bar"
60 [email protected] " " 60 [email protected] " "
61 RECORD_FIELD_PAT_[email protected] 61 RECORD_PAT_[email protected]
62 [email protected] "{" 62 [email protected] "{"
63 [email protected] " " 63 [email protected] " "
64 [email protected] ".." 64 [email protected] ".."
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
index fe1c290c3..003c517ac 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "S" 21 [email protected] "S"
22 [email protected] " " 22 [email protected] " "
23 RECORD_FIELD_PAT_[email protected] 23 RECORD_PAT_[email protected]
24 [email protected] "{" 24 [email protected] "{"
25 [email protected] "}" 25 [email protected] "}"
26 [email protected] " " 26 [email protected] " "
@@ -40,16 +40,16 @@ [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "S" 41 [email protected] "S"
42 [email protected] " " 42 [email protected] " "
43 RECORD_FIELD_PAT_[email protected] 43 RECORD_PAT_[email protected]
44 [email protected] "{" 44 [email protected] "{"
45 [email protected] " " 45 [email protected] " "
46 RECORD_FIELD_PAT@42..43 46 RECORD_PAT_[email protected]
47 [email protected] 47 [email protected]
48 [email protected] 48 [email protected]
49 [email protected] "f" 49 [email protected] "f"
50 [email protected] "," 50 [email protected] ","
51 [email protected] " " 51 [email protected] " "
52 RECORD_FIELD_PAT@45..54 52 RECORD_PAT_[email protected]
53 [email protected] 53 [email protected]
54 [email protected] "ref" 54 [email protected] "ref"
55 [email protected] " " 55 [email protected] " "
@@ -76,10 +76,10 @@ [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "S" 77 [email protected] "S"
78 [email protected] " " 78 [email protected] " "
79 RECORD_FIELD_PAT_[email protected] 79 RECORD_PAT_[email protected]
80 [email protected] "{" 80 [email protected] "{"
81 [email protected] " " 81 [email protected] " "
82 RECORD_FIELD_PAT@75..79 82 RECORD_PAT_[email protected]
83 [email protected] 83 [email protected]
84 [email protected] "h" 84 [email protected] "h"
85 [email protected] ":" 85 [email protected] ":"
@@ -107,10 +107,10 @@ [email protected]
107 [email protected] 107 [email protected]
108 [email protected] "S" 108 [email protected] "S"
109 [email protected] " " 109 [email protected] " "
110 RECORD_FIELD_PAT_[email protected] 110 RECORD_PAT_[email protected]
111 [email protected] "{" 111 [email protected] "{"
112 [email protected] " " 112 [email protected] " "
113 RECORD_FIELD_PAT@103..107 113 RECORD_PAT_[email protected]
114 [email protected] 114 [email protected]
115 [email protected] "h" 115 [email protected] "h"
116 [email protected] ":" 116 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
index 09fd9e9b8..caae3e2dc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast
@@ -40,10 +40,10 @@ [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "Outer" 41 [email protected] "Outer"
42 [email protected] " " 42 [email protected] " "
43 RECORD_FIELD_PAT_[email protected] 43 RECORD_PAT_[email protected]
44 [email protected] "{" 44 [email protected] "{"
45 [email protected] " " 45 [email protected] " "
46 RECORD_FIELD_PAT@52..57 46 RECORD_PAT_[email protected]
47 [email protected] 47 [email protected]
48 [email protected] "box" 48 [email protected] "box"
49 [email protected] " " 49 [email protected] " "
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] "i" 52 [email protected] "i"
53 [email protected] "," 53 [email protected] ","
54 [email protected] " " 54 [email protected] " "
55 RECORD_FIELD_PAT@59..79 55 RECORD_PAT_[email protected]
56 [email protected] 56 [email protected]
57 [email protected] "j" 57 [email protected] "j"
58 [email protected] ":" 58 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
index b41ef4098..925409bdf 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast
@@ -20,10 +20,10 @@ [email protected]
20 [email protected] 20 [email protected]
21 [email protected] "S" 21 [email protected] "S"
22 [email protected] " " 22 [email protected] " "
23 RECORD_FIELD_PAT_[email protected] 23 RECORD_PAT_[email protected]
24 [email protected] "{" 24 [email protected] "{"
25 [email protected] " " 25 [email protected] " "
26 RECORD_FIELD_PAT@23..27 26 RECORD_PAT_[email protected]
27 [email protected] 27 [email protected]
28 [email protected] "0" 28 [email protected] "0"
29 [email protected] ":" 29 [email protected] ":"
@@ -50,10 +50,10 @@ [email protected]
50 [email protected] 50 [email protected]
51 [email protected] "S" 51 [email protected] "S"
52 [email protected] " " 52 [email protected] " "
53 RECORD_FIELD_PAT_[email protected] 53 RECORD_PAT_[email protected]
54 [email protected] "{" 54 [email protected] "{"
55 [email protected] " " 55 [email protected] " "
56 RECORD_FIELD_PAT@48..52 56 RECORD_PAT_[email protected]
57 [email protected] 57 [email protected]
58 [email protected] "x" 58 [email protected] "x"
59 [email protected] ":" 59 [email protected] ":"
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
index facce8167..7c5467289 100644
--- a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
@@ -64,16 +64,16 @@ [email protected]
64 [email protected] 64 [email protected]
65 [email protected] "S" 65 [email protected] "S"
66 [email protected] " " 66 [email protected] " "
67 RECORD_FIELD_PAT_[email protected] 67 RECORD_PAT_[email protected]
68 [email protected] "{" 68 [email protected] "{"
69 [email protected] " " 69 [email protected] " "
70 RECORD_FIELD_PAT@61..62 70 RECORD_PAT_[email protected]
71 [email protected] 71 [email protected]
72 [email protected] 72 [email protected]
73 [email protected] "a" 73 [email protected] "a"
74 [email protected] "," 74 [email protected] ","
75 [email protected] " " 75 [email protected] " "
76 RECORD_FIELD_PAT@64..65 76 RECORD_PAT_[email protected]
77 [email protected] 77 [email protected]
78 [email protected] 78 [email protected]
79 [email protected] "b" 79 [email protected] "b"
diff --git a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
index 453757c3c..087053f25 100644
--- a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
@@ -67,16 +67,16 @@ [email protected]
67 [email protected] 67 [email protected]
68 [email protected] "S" 68 [email protected] "S"
69 [email protected] " " 69 [email protected] " "
70 RECORD_FIELD_PAT_[email protected] 70 RECORD_PAT_[email protected]
71 [email protected] "{" 71 [email protected] "{"
72 [email protected] " " 72 [email protected] " "
73 RECORD_FIELD_PAT@60..61 73 RECORD_PAT_[email protected]
74 [email protected] 74 [email protected]
75 [email protected] 75 [email protected]
76 [email protected] "a" 76 [email protected] "a"
77 [email protected] "," 77 [email protected] ","
78 [email protected] " " 78 [email protected] " "
79 RECORD_FIELD_PAT@63..64 79 RECORD_PAT_[email protected]
80 [email protected] 80 [email protected]
81 [email protected] 81 [email protected]
82 [email protected] "b" 82 [email protected] "b"