diff options
Diffstat (limited to 'crates/ra_syntax')
4 files changed, 25 insertions, 25 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 1776fb6e6..d153e8528 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -199,14 +199,14 @@ impl TypeAlias { | |||
199 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 199 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
200 | } | 200 | } |
201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
202 | pub struct UnionDef { | 202 | pub struct Union { |
203 | pub(crate) syntax: SyntaxNode, | 203 | pub(crate) syntax: SyntaxNode, |
204 | } | 204 | } |
205 | impl ast::AttrsOwner for UnionDef {} | 205 | impl ast::AttrsOwner for Union {} |
206 | impl ast::NameOwner for UnionDef {} | 206 | impl ast::NameOwner for Union {} |
207 | impl ast::VisibilityOwner for UnionDef {} | 207 | impl ast::VisibilityOwner for Union {} |
208 | impl ast::GenericParamsOwner for UnionDef {} | 208 | impl ast::GenericParamsOwner for Union {} |
209 | impl UnionDef { | 209 | impl Union { |
210 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } | 210 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } |
211 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | 211 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } |
212 | } | 212 | } |
@@ -1284,7 +1284,7 @@ pub enum Item { | |||
1284 | StructDef(StructDef), | 1284 | StructDef(StructDef), |
1285 | TraitDef(TraitDef), | 1285 | TraitDef(TraitDef), |
1286 | TypeAlias(TypeAlias), | 1286 | TypeAlias(TypeAlias), |
1287 | UnionDef(UnionDef), | 1287 | Union(Union), |
1288 | Use(Use), | 1288 | Use(Use), |
1289 | } | 1289 | } |
1290 | impl ast::AttrsOwner for Item {} | 1290 | impl ast::AttrsOwner for Item {} |
@@ -1393,7 +1393,7 @@ impl ast::VisibilityOwner for ExternItem {} | |||
1393 | pub enum AdtDef { | 1393 | pub enum AdtDef { |
1394 | StructDef(StructDef), | 1394 | StructDef(StructDef), |
1395 | EnumDef(EnumDef), | 1395 | EnumDef(EnumDef), |
1396 | UnionDef(UnionDef), | 1396 | Union(Union), |
1397 | } | 1397 | } |
1398 | impl ast::AttrsOwner for AdtDef {} | 1398 | impl ast::AttrsOwner for AdtDef {} |
1399 | impl ast::GenericParamsOwner for AdtDef {} | 1399 | impl ast::GenericParamsOwner for AdtDef {} |
@@ -1553,8 +1553,8 @@ impl AstNode for TypeAlias { | |||
1553 | } | 1553 | } |
1554 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1554 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1555 | } | 1555 | } |
1556 | impl AstNode for UnionDef { | 1556 | impl AstNode for Union { |
1557 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } | 1557 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } |
1558 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1558 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1559 | if Self::can_cast(syntax.kind()) { | 1559 | if Self::can_cast(syntax.kind()) { |
1560 | Some(Self { syntax }) | 1560 | Some(Self { syntax }) |
@@ -2810,8 +2810,8 @@ impl From<TraitDef> for Item { | |||
2810 | impl From<TypeAlias> for Item { | 2810 | impl From<TypeAlias> for Item { |
2811 | fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } | 2811 | fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } |
2812 | } | 2812 | } |
2813 | impl From<UnionDef> for Item { | 2813 | impl From<Union> for Item { |
2814 | fn from(node: UnionDef) -> Item { Item::UnionDef(node) } | 2814 | fn from(node: Union) -> Item { Item::Union(node) } |
2815 | } | 2815 | } |
2816 | impl From<Use> for Item { | 2816 | impl From<Use> for Item { |
2817 | fn from(node: Use) -> Item { Item::Use(node) } | 2817 | fn from(node: Use) -> Item { Item::Use(node) } |
@@ -2820,7 +2820,7 @@ impl AstNode for Item { | |||
2820 | fn can_cast(kind: SyntaxKind) -> bool { | 2820 | fn can_cast(kind: SyntaxKind) -> bool { |
2821 | match kind { | 2821 | match kind { |
2822 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | 2822 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL |
2823 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true, | 2823 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, |
2824 | _ => false, | 2824 | _ => false, |
2825 | } | 2825 | } |
2826 | } | 2826 | } |
@@ -2838,7 +2838,7 @@ impl AstNode for Item { | |||
2838 | STRUCT_DEF => Item::StructDef(StructDef { syntax }), | 2838 | STRUCT_DEF => Item::StructDef(StructDef { syntax }), |
2839 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), | 2839 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), |
2840 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), | 2840 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), |
2841 | UNION_DEF => Item::UnionDef(UnionDef { syntax }), | 2841 | UNION => Item::Union(Union { syntax }), |
2842 | USE => Item::Use(Use { syntax }), | 2842 | USE => Item::Use(Use { syntax }), |
2843 | _ => return None, | 2843 | _ => return None, |
2844 | }; | 2844 | }; |
@@ -2858,7 +2858,7 @@ impl AstNode for Item { | |||
2858 | Item::StructDef(it) => &it.syntax, | 2858 | Item::StructDef(it) => &it.syntax, |
2859 | Item::TraitDef(it) => &it.syntax, | 2859 | Item::TraitDef(it) => &it.syntax, |
2860 | Item::TypeAlias(it) => &it.syntax, | 2860 | Item::TypeAlias(it) => &it.syntax, |
2861 | Item::UnionDef(it) => &it.syntax, | 2861 | Item::Union(it) => &it.syntax, |
2862 | Item::Use(it) => &it.syntax, | 2862 | Item::Use(it) => &it.syntax, |
2863 | } | 2863 | } |
2864 | } | 2864 | } |
@@ -3378,13 +3378,13 @@ impl From<StructDef> for AdtDef { | |||
3378 | impl From<EnumDef> for AdtDef { | 3378 | impl From<EnumDef> for AdtDef { |
3379 | fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } | 3379 | fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } |
3380 | } | 3380 | } |
3381 | impl From<UnionDef> for AdtDef { | 3381 | impl From<Union> for AdtDef { |
3382 | fn from(node: UnionDef) -> AdtDef { AdtDef::UnionDef(node) } | 3382 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } |
3383 | } | 3383 | } |
3384 | impl AstNode for AdtDef { | 3384 | impl AstNode for AdtDef { |
3385 | fn can_cast(kind: SyntaxKind) -> bool { | 3385 | fn can_cast(kind: SyntaxKind) -> bool { |
3386 | match kind { | 3386 | match kind { |
3387 | STRUCT_DEF | ENUM_DEF | UNION_DEF => true, | 3387 | STRUCT_DEF | ENUM_DEF | UNION => true, |
3388 | _ => false, | 3388 | _ => false, |
3389 | } | 3389 | } |
3390 | } | 3390 | } |
@@ -3392,7 +3392,7 @@ impl AstNode for AdtDef { | |||
3392 | let res = match syntax.kind() { | 3392 | let res = match syntax.kind() { |
3393 | STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), | 3393 | STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), |
3394 | ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), | 3394 | ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), |
3395 | UNION_DEF => AdtDef::UnionDef(UnionDef { syntax }), | 3395 | UNION => AdtDef::Union(Union { syntax }), |
3396 | _ => return None, | 3396 | _ => return None, |
3397 | }; | 3397 | }; |
3398 | Some(res) | 3398 | Some(res) |
@@ -3401,7 +3401,7 @@ impl AstNode for AdtDef { | |||
3401 | match self { | 3401 | match self { |
3402 | AdtDef::StructDef(it) => &it.syntax, | 3402 | AdtDef::StructDef(it) => &it.syntax, |
3403 | AdtDef::EnumDef(it) => &it.syntax, | 3403 | AdtDef::EnumDef(it) => &it.syntax, |
3404 | AdtDef::UnionDef(it) => &it.syntax, | 3404 | AdtDef::Union(it) => &it.syntax, |
3405 | } | 3405 | } |
3406 | } | 3406 | } |
3407 | } | 3407 | } |
@@ -3525,7 +3525,7 @@ impl std::fmt::Display for TypeAlias { | |||
3525 | std::fmt::Display::fmt(self.syntax(), f) | 3525 | std::fmt::Display::fmt(self.syntax(), f) |
3526 | } | 3526 | } |
3527 | } | 3527 | } |
3528 | impl std::fmt::Display for UnionDef { | 3528 | impl std::fmt::Display for Union { |
3529 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3529 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3530 | std::fmt::Display::fmt(self.syntax(), f) | 3530 | std::fmt::Display::fmt(self.syntax(), f) |
3531 | } | 3531 | } |
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index ffe6746d3..ce11a7513 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -476,7 +476,7 @@ impl ast::TokenTree { | |||
476 | impl ast::DocCommentsOwner for ast::SourceFile {} | 476 | impl ast::DocCommentsOwner for ast::SourceFile {} |
477 | impl ast::DocCommentsOwner for ast::Fn {} | 477 | impl ast::DocCommentsOwner for ast::Fn {} |
478 | impl ast::DocCommentsOwner for ast::StructDef {} | 478 | impl ast::DocCommentsOwner for ast::StructDef {} |
479 | impl ast::DocCommentsOwner for ast::UnionDef {} | 479 | impl ast::DocCommentsOwner for ast::Union {} |
480 | impl ast::DocCommentsOwner for ast::RecordField {} | 480 | impl ast::DocCommentsOwner for ast::RecordField {} |
481 | impl ast::DocCommentsOwner for ast::TupleField {} | 481 | impl ast::DocCommentsOwner for ast::TupleField {} |
482 | impl ast::DocCommentsOwner for ast::EnumDef {} | 482 | impl ast::DocCommentsOwner for ast::EnumDef {} |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast index 2726516b8..6589e4795 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | UNION_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "union" | 3 | [email protected] "union" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -9,7 +9,7 @@ [email protected] | |||
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "}" | 10 | [email protected] "}" |
11 | [email protected] "\n" | 11 | [email protected] "\n" |
12 | UNION_DEF@13..50 | 12 | [email protected] |
13 | [email protected] "union" | 13 | [email protected] "union" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | [email protected] | 15 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index 2aa075993..b04a505ea 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast | |||
@@ -1560,7 +1560,7 @@ [email protected] | |||
1560 | [email protected] | 1560 | [email protected] |
1561 | [email protected] "{" | 1561 | [email protected] "{" |
1562 | [email protected] "\n " | 1562 | [email protected] "\n " |
1563 | UNION_DEF@2851..2904 | 1563 | [email protected] |
1564 | [email protected] "union" | 1564 | [email protected] "union" |
1565 | [email protected] " " | 1565 | [email protected] " " |
1566 | [email protected] | 1566 | [email protected] |