aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 16:56:53 +0100
committerAleksey Kladov <[email protected]>2020-07-30 16:56:53 +0100
commit1766aae145c6925a33e427f2fe6ef2a56c301665 (patch)
treedfcf22990794a5990602a468b862d544fbe63f0a /crates/ra_syntax
parent609680ef97dbf82c07b6b06e21aa366423892304 (diff)
Rename EnumVariant -> Variant
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs30
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs4
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0025_nope.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0019_enums.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast4
9 files changed, 49 insertions, 49 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 1d1452546..6613b54ba 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -53,7 +53,7 @@ impl ast::VisibilityOwner for Enum {}
53impl ast::GenericParamsOwner for Enum {} 53impl ast::GenericParamsOwner for Enum {}
54impl Enum { 54impl Enum {
55 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } 55 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
56 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } 56 pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) }
57} 57}
58#[derive(Debug, Clone, PartialEq, Eq, Hash)] 58#[derive(Debug, Clone, PartialEq, Eq, Hash)]
59pub struct ExternBlock { 59pub struct ExternBlock {
@@ -427,22 +427,22 @@ impl TupleField {
427 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 427 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
428} 428}
429#[derive(Debug, Clone, PartialEq, Eq, Hash)] 429#[derive(Debug, Clone, PartialEq, Eq, Hash)]
430pub struct EnumVariantList { 430pub struct VariantList {
431 pub(crate) syntax: SyntaxNode, 431 pub(crate) syntax: SyntaxNode,
432} 432}
433impl EnumVariantList { 433impl VariantList {
434 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 434 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
435 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } 435 pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) }
436 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 436 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
437} 437}
438#[derive(Debug, Clone, PartialEq, Eq, Hash)] 438#[derive(Debug, Clone, PartialEq, Eq, Hash)]
439pub struct EnumVariant { 439pub struct Variant {
440 pub(crate) syntax: SyntaxNode, 440 pub(crate) syntax: SyntaxNode,
441} 441}
442impl ast::AttrsOwner for EnumVariant {} 442impl ast::AttrsOwner for Variant {}
443impl ast::NameOwner for EnumVariant {} 443impl ast::NameOwner for Variant {}
444impl ast::VisibilityOwner for EnumVariant {} 444impl ast::VisibilityOwner for Variant {}
445impl EnumVariant { 445impl Variant {
446 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } 446 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
447 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 447 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
448 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 448 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
@@ -1806,8 +1806,8 @@ impl AstNode for TupleField {
1806 } 1806 }
1807 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1807 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1808} 1808}
1809impl AstNode for EnumVariantList { 1809impl AstNode for VariantList {
1810 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } 1810 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
1811 fn cast(syntax: SyntaxNode) -> Option<Self> { 1811 fn cast(syntax: SyntaxNode) -> Option<Self> {
1812 if Self::can_cast(syntax.kind()) { 1812 if Self::can_cast(syntax.kind()) {
1813 Some(Self { syntax }) 1813 Some(Self { syntax })
@@ -1817,8 +1817,8 @@ impl AstNode for EnumVariantList {
1817 } 1817 }
1818 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1818 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1819} 1819}
1820impl AstNode for EnumVariant { 1820impl AstNode for Variant {
1821 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } 1821 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
1822 fn cast(syntax: SyntaxNode) -> Option<Self> { 1822 fn cast(syntax: SyntaxNode) -> Option<Self> {
1823 if Self::can_cast(syntax.kind()) { 1823 if Self::can_cast(syntax.kind()) {
1824 Some(Self { syntax }) 1824 Some(Self { syntax })
@@ -3640,12 +3640,12 @@ impl std::fmt::Display for TupleField {
3640 std::fmt::Display::fmt(self.syntax(), f) 3640 std::fmt::Display::fmt(self.syntax(), f)
3641 } 3641 }
3642} 3642}
3643impl std::fmt::Display for EnumVariantList { 3643impl std::fmt::Display for VariantList {
3644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3645 std::fmt::Display::fmt(self.syntax(), f) 3645 std::fmt::Display::fmt(self.syntax(), f)
3646 } 3646 }
3647} 3647}
3648impl std::fmt::Display for EnumVariant { 3648impl std::fmt::Display for Variant {
3649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3650 std::fmt::Display::fmt(self.syntax(), f) 3650 std::fmt::Display::fmt(self.syntax(), f)
3651 } 3651 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 02e6e52c2..05ec49cec 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -247,7 +247,7 @@ impl ast::RecordFieldPat {
247 } 247 }
248} 248}
249 249
250impl ast::EnumVariant { 250impl ast::Variant {
251 pub fn parent_enum(&self) -> ast::Enum { 251 pub fn parent_enum(&self) -> ast::Enum {
252 self.syntax() 252 self.syntax()
253 .parent() 253 .parent()
@@ -480,7 +480,7 @@ impl ast::DocCommentsOwner for ast::Union {}
480impl ast::DocCommentsOwner for ast::RecordField {} 480impl ast::DocCommentsOwner for ast::RecordField {}
481impl ast::DocCommentsOwner for ast::TupleField {} 481impl ast::DocCommentsOwner for ast::TupleField {}
482impl ast::DocCommentsOwner for ast::Enum {} 482impl ast::DocCommentsOwner for ast::Enum {}
483impl ast::DocCommentsOwner for ast::EnumVariant {} 483impl ast::DocCommentsOwner for ast::Variant {}
484impl ast::DocCommentsOwner for ast::TraitDef {} 484impl ast::DocCommentsOwner for ast::TraitDef {}
485impl ast::DocCommentsOwner for ast::Module {} 485impl ast::DocCommentsOwner for ast::Module {}
486impl ast::DocCommentsOwner for ast::StaticDef {} 486impl ast::DocCommentsOwner for ast::StaticDef {}
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index faffd0d32..c586dc320 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -146,7 +146,7 @@ fn n_attached_trivias<'a>(
146 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, 146 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
147) -> usize { 147) -> usize {
148 match kind { 148 match kind {
149 MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | ENUM_VARIANT | FN | TRAIT_DEF 149 MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF
150 | MODULE | RECORD_FIELD | STATIC_DEF => { 150 | MODULE | RECORD_FIELD | STATIC_DEF => {
151 let mut res = 0; 151 let mut res = 0;
152 let mut trivias = trivias.enumerate().peekable(); 152 let mut trivias = trivias.enumerate().peekable();
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
index 94456e48c..fca646557 100644
--- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast
+++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
@@ -17,15 +17,15 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "Test" 18 [email protected] "Test"
19 [email protected] " " 19 [email protected] " "
20 ENUM_[email protected] 20 [email protected]
21 [email protected] "{" 21 [email protected] "{"
22 [email protected] "\n " 22 [email protected] "\n "
23 ENUM_[email protected] 23 [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "Var1" 25 [email protected] "Var1"
26 [email protected] "," 26 [email protected] ","
27 [email protected] "\n " 27 [email protected] "\n "
28 ENUM_[email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Var2" 30 [email protected] "Var2"
31 [email protected] 31 [email protected]
@@ -39,7 +39,7 @@ [email protected]
39 [email protected] ")" 39 [email protected] ")"
40 [email protected] "," 40 [email protected] ","
41 [email protected] "\n " 41 [email protected] "\n "
42 ENUM_[email protected] 42 [email protected]
43 [email protected] 43 [email protected]
44 [email protected] "Var3" 44 [email protected] "Var3"
45 [email protected] " " 45 [email protected] " "
@@ -85,10 +85,10 @@ [email protected]
85 [email protected] 85 [email protected]
86 [email protected] "Test2" 86 [email protected] "Test2"
87 [email protected] " " 87 [email protected] " "
88 ENUM_[email protected] 88 [email protected]
89 [email protected] "{" 89 [email protected] "{"
90 [email protected] "\n " 90 [email protected] "\n "
91 ENUM_[email protected] 91 [email protected]
92 [email protected] 92 [email protected]
93 [email protected] "Fine" 93 [email protected] "Fine"
94 [email protected] "," 94 [email protected] ","
@@ -101,10 +101,10 @@ [email protected]
101 [email protected] 101 [email protected]
102 [email protected] "Test3" 102 [email protected] "Test3"
103 [email protected] " " 103 [email protected] " "
104 ENUM_[email protected] 104 [email protected]
105 [email protected] "{" 105 [email protected] "{"
106 [email protected] "\n " 106 [email protected] "\n "
107 ENUM_[email protected] 107 [email protected]
108 [email protected] 108 [email protected]
109 [email protected] "StillFine" 109 [email protected] "StillFine"
110 [email protected] " " 110 [email protected] " "
@@ -140,10 +140,10 @@ [email protected]
140 [email protected] 140 [email protected]
141 [email protected] "Test4" 141 [email protected] "Test4"
142 [email protected] " " 142 [email protected] " "
143 ENUM_[email protected] 143 [email protected]
144 [email protected] "{" 144 [email protected] "{"
145 [email protected] "\n " 145 [email protected] "\n "
146 ENUM_[email protected] 146 [email protected]
147 [email protected] 147 [email protected]
148 [email protected] "Nope" 148 [email protected] "Nope"
149 [email protected] 149 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
index 25e6cc170..f2561abd6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -4,7 +4,7 @@ [email protected]
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
6 [email protected] "F" 6 [email protected] "F"
7 ENUM_[email protected] 7 [email protected]
8 [email protected] "{" 8 [email protected] "{"
9 [email protected] "}" 9 [email protected] "}"
10 [email protected] "\n" 10 [email protected] "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
index 9cc8172e0..429a0506e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
@@ -17,15 +17,15 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "LocalEnum" 18 [email protected] "LocalEnum"
19 [email protected] " " 19 [email protected] " "
20 ENUM_[email protected] 20 [email protected]
21 [email protected] "{" 21 [email protected] "{"
22 [email protected] "\n " 22 [email protected] "\n "
23 ENUM_[email protected] 23 [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "One" 25 [email protected] "One"
26 [email protected] "," 26 [email protected] ","
27 [email protected] "\n " 27 [email protected] "\n "
28 ENUM_[email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Two" 30 [email protected] "Two"
31 [email protected] "," 31 [email protected] ","
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
index 0331558d2..a2e05eb2e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
@@ -5,10 +5,10 @@ [email protected]
5 [email protected] 5 [email protected]
6 [email protected] "E" 6 [email protected] "E"
7 [email protected] " " 7 [email protected] " "
8 ENUM_[email protected] 8 [email protected]
9 [email protected] "{" 9 [email protected] "{"
10 [email protected] " " 10 [email protected] " "
11 ENUM_[email protected] 11 [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "X" 13 [email protected] "X"
14 [email protected] 14 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
index 1ffcffc1a..c3df00814 100644
--- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
@@ -5,7 +5,7 @@ [email protected]
5 [email protected] 5 [email protected]
6 [email protected] "E1" 6 [email protected] "E1"
7 [email protected] " " 7 [email protected] " "
8 ENUM_[email protected] 8 [email protected]
9 [email protected] "{" 9 [email protected] "{"
10 [email protected] "\n" 10 [email protected] "\n"
11 [email protected] "}" 11 [email protected] "}"
@@ -22,7 +22,7 @@ [email protected]
22 [email protected] "T" 22 [email protected] "T"
23 [email protected] ">" 23 [email protected] ">"
24 [email protected] " " 24 [email protected] " "
25 ENUM_[email protected] 25 [email protected]
26 [email protected] "{" 26 [email protected] "{"
27 [email protected] "\n" 27 [email protected] "\n"
28 [email protected] "}" 28 [email protected] "}"
@@ -33,10 +33,10 @@ [email protected]
33 [email protected] 33 [email protected]
34 [email protected] "E3" 34 [email protected] "E3"
35 [email protected] " " 35 [email protected] " "
36 ENUM_[email protected] 36 [email protected]
37 [email protected] "{" 37 [email protected] "{"
38 [email protected] "\n " 38 [email protected] "\n "
39 ENUM_[email protected] 39 [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "X" 41 [email protected] "X"
42 [email protected] "\n" 42 [email protected] "\n"
@@ -48,10 +48,10 @@ [email protected]
48 [email protected] 48 [email protected]
49 [email protected] "E4" 49 [email protected] "E4"
50 [email protected] " " 50 [email protected] " "
51 ENUM_[email protected] 51 [email protected]
52 [email protected] "{" 52 [email protected] "{"
53 [email protected] "\n " 53 [email protected] "\n "
54 ENUM_[email protected] 54 [email protected]
55 [email protected] 55 [email protected]
56 [email protected] "X" 56 [email protected] "X"
57 [email protected] "," 57 [email protected] ","
@@ -64,15 +64,15 @@ [email protected]
64 [email protected] 64 [email protected]
65 [email protected] "E5" 65 [email protected] "E5"
66 [email protected] " " 66 [email protected] " "
67 ENUM_[email protected] 67 [email protected]
68 [email protected] "{" 68 [email protected] "{"
69 [email protected] "\n " 69 [email protected] "\n "
70 ENUM_[email protected] 70 [email protected]
71 [email protected] 71 [email protected]
72 [email protected] "A" 72 [email protected] "A"
73 [email protected] "," 73 [email protected] ","
74 [email protected] "\n " 74 [email protected] "\n "
75 ENUM_[email protected] 75 [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "B" 77 [email protected] "B"
78 [email protected] " " 78 [email protected] " "
@@ -82,7 +82,7 @@ [email protected]
82 [email protected] "92" 82 [email protected] "92"
83 [email protected] "," 83 [email protected] ","
84 [email protected] "\n " 84 [email protected] "\n "
85 ENUM_[email protected] 85 [email protected]
86 [email protected] 86 [email protected]
87 [email protected] "C" 87 [email protected] "C"
88 [email protected] " " 88 [email protected] " "
@@ -119,7 +119,7 @@ [email protected]
119 [email protected] "}" 119 [email protected] "}"
120 [email protected] "," 120 [email protected] ","
121 [email protected] "\n " 121 [email protected] "\n "
122 ENUM_[email protected] 122 [email protected]
123 [email protected] 123 [email protected]
124 [email protected] "F" 124 [email protected] "F"
125 [email protected] " " 125 [email protected] " "
@@ -128,7 +128,7 @@ [email protected]
128 [email protected] "}" 128 [email protected] "}"
129 [email protected] "," 129 [email protected] ","
130 [email protected] "\n " 130 [email protected] "\n "
131 ENUM_[email protected] 131 [email protected]
132 [email protected] 132 [email protected]
133 [email protected] "D" 133 [email protected] "D"
134 [email protected] 134 [email protected]
@@ -143,7 +143,7 @@ [email protected]
143 [email protected] ")" 143 [email protected] ")"
144 [email protected] "," 144 [email protected] ","
145 [email protected] "\n " 145 [email protected] "\n "
146 ENUM_[email protected] 146 [email protected]
147 [email protected] 147 [email protected]
148 [email protected] "E" 148 [email protected] "E"
149 [email protected] 149 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
index 9db4f0aa1..7a54fa113 100644
--- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
@@ -262,10 +262,10 @@ [email protected]
262 [email protected] 262 [email protected]
263 [email protected] "A" 263 [email protected] "A"
264 [email protected] " " 264 [email protected] " "
265 ENUM_[email protected] 265 [email protected]
266 [email protected] "{" 266 [email protected] "{"
267 [email protected] "\n " 267 [email protected] "\n "
268 ENUM_[email protected] 268 [email protected]
269 [email protected] 269 [email protected]
270 [email protected] "B" 270 [email protected] "B"
271 [email protected] 271 [email protected]