diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 42 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/node_ext.rs | 6 |
2 files changed, 24 insertions, 24 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 0fd3d4f1b..1d1452546 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -44,14 +44,14 @@ impl ConstDef { | |||
44 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 44 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
45 | } | 45 | } |
46 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 46 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
47 | pub struct EnumDef { | 47 | pub struct Enum { |
48 | pub(crate) syntax: SyntaxNode, | 48 | pub(crate) syntax: SyntaxNode, |
49 | } | 49 | } |
50 | impl ast::AttrsOwner for EnumDef {} | 50 | impl ast::AttrsOwner for Enum {} |
51 | impl ast::NameOwner for EnumDef {} | 51 | impl ast::NameOwner for Enum {} |
52 | impl ast::VisibilityOwner for EnumDef {} | 52 | impl ast::VisibilityOwner for Enum {} |
53 | impl ast::GenericParamsOwner for EnumDef {} | 53 | impl ast::GenericParamsOwner for Enum {} |
54 | impl EnumDef { | 54 | impl 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<EnumVariantList> { support::child(&self.syntax) } |
57 | } | 57 | } |
@@ -1273,7 +1273,7 @@ impl MetaItem { | |||
1273 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1273 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1274 | pub enum Item { | 1274 | pub enum Item { |
1275 | ConstDef(ConstDef), | 1275 | ConstDef(ConstDef), |
1276 | EnumDef(EnumDef), | 1276 | Enum(Enum), |
1277 | ExternBlock(ExternBlock), | 1277 | ExternBlock(ExternBlock), |
1278 | ExternCrate(ExternCrate), | 1278 | ExternCrate(ExternCrate), |
1279 | Fn(Fn), | 1279 | Fn(Fn), |
@@ -1392,7 +1392,7 @@ impl ast::VisibilityOwner for ExternItem {} | |||
1392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1393 | pub enum AdtDef { | 1393 | pub enum AdtDef { |
1394 | Struct(Struct), | 1394 | Struct(Struct), |
1395 | EnumDef(EnumDef), | 1395 | Enum(Enum), |
1396 | Union(Union), | 1396 | Union(Union), |
1397 | } | 1397 | } |
1398 | impl ast::AttrsOwner for AdtDef {} | 1398 | impl ast::AttrsOwner for AdtDef {} |
@@ -1432,8 +1432,8 @@ impl AstNode for ConstDef { | |||
1432 | } | 1432 | } |
1433 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1433 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1434 | } | 1434 | } |
1435 | impl AstNode for EnumDef { | 1435 | impl AstNode for Enum { |
1436 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } | 1436 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } |
1437 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1437 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1438 | if Self::can_cast(syntax.kind()) { | 1438 | if Self::can_cast(syntax.kind()) { |
1439 | Some(Self { syntax }) | 1439 | Some(Self { syntax }) |
@@ -2777,8 +2777,8 @@ impl AstNode for MetaItem { | |||
2777 | impl From<ConstDef> for Item { | 2777 | impl From<ConstDef> for Item { |
2778 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } | 2778 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } |
2779 | } | 2779 | } |
2780 | impl From<EnumDef> for Item { | 2780 | impl From<Enum> for Item { |
2781 | fn from(node: EnumDef) -> Item { Item::EnumDef(node) } | 2781 | fn from(node: Enum) -> Item { Item::Enum(node) } |
2782 | } | 2782 | } |
2783 | impl From<ExternBlock> for Item { | 2783 | impl From<ExternBlock> for Item { |
2784 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } | 2784 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } |
@@ -2819,7 +2819,7 @@ impl From<Use> for Item { | |||
2819 | impl AstNode for Item { | 2819 | 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 | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL |
2823 | | MODULE | STATIC_DEF | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, | 2823 | | MODULE | STATIC_DEF | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, |
2824 | _ => false, | 2824 | _ => false, |
2825 | } | 2825 | } |
@@ -2827,7 +2827,7 @@ impl AstNode for Item { | |||
2827 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2827 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2828 | let res = match syntax.kind() { | 2828 | let res = match syntax.kind() { |
2829 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), | 2829 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), |
2830 | ENUM_DEF => Item::EnumDef(EnumDef { syntax }), | 2830 | ENUM => Item::Enum(Enum { syntax }), |
2831 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), | 2831 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), |
2832 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), | 2832 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), |
2833 | FN => Item::Fn(Fn { syntax }), | 2833 | FN => Item::Fn(Fn { syntax }), |
@@ -2847,7 +2847,7 @@ impl AstNode for Item { | |||
2847 | fn syntax(&self) -> &SyntaxNode { | 2847 | fn syntax(&self) -> &SyntaxNode { |
2848 | match self { | 2848 | match self { |
2849 | Item::ConstDef(it) => &it.syntax, | 2849 | Item::ConstDef(it) => &it.syntax, |
2850 | Item::EnumDef(it) => &it.syntax, | 2850 | Item::Enum(it) => &it.syntax, |
2851 | Item::ExternBlock(it) => &it.syntax, | 2851 | Item::ExternBlock(it) => &it.syntax, |
2852 | Item::ExternCrate(it) => &it.syntax, | 2852 | Item::ExternCrate(it) => &it.syntax, |
2853 | Item::Fn(it) => &it.syntax, | 2853 | Item::Fn(it) => &it.syntax, |
@@ -3375,8 +3375,8 @@ impl AstNode for ExternItem { | |||
3375 | impl From<Struct> for AdtDef { | 3375 | impl From<Struct> for AdtDef { |
3376 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } | 3376 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } |
3377 | } | 3377 | } |
3378 | impl From<EnumDef> for AdtDef { | 3378 | impl From<Enum> for AdtDef { |
3379 | fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } | 3379 | fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } |
3380 | } | 3380 | } |
3381 | impl From<Union> for AdtDef { | 3381 | impl From<Union> for AdtDef { |
3382 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } | 3382 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } |
@@ -3384,14 +3384,14 @@ impl From<Union> for AdtDef { | |||
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 | ENUM_DEF | UNION => true, | 3387 | STRUCT | ENUM | UNION => true, |
3388 | _ => false, | 3388 | _ => false, |
3389 | } | 3389 | } |
3390 | } | 3390 | } |
3391 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3391 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3392 | let res = match syntax.kind() { | 3392 | let res = match syntax.kind() { |
3393 | STRUCT => AdtDef::Struct(Struct { syntax }), | 3393 | STRUCT => AdtDef::Struct(Struct { syntax }), |
3394 | ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), | 3394 | ENUM => AdtDef::Enum(Enum { syntax }), |
3395 | UNION => AdtDef::Union(Union { syntax }), | 3395 | UNION => AdtDef::Union(Union { syntax }), |
3396 | _ => return None, | 3396 | _ => return None, |
3397 | }; | 3397 | }; |
@@ -3400,7 +3400,7 @@ impl AstNode for AdtDef { | |||
3400 | fn syntax(&self) -> &SyntaxNode { | 3400 | fn syntax(&self) -> &SyntaxNode { |
3401 | match self { | 3401 | match self { |
3402 | AdtDef::Struct(it) => &it.syntax, | 3402 | AdtDef::Struct(it) => &it.syntax, |
3403 | AdtDef::EnumDef(it) => &it.syntax, | 3403 | AdtDef::Enum(it) => &it.syntax, |
3404 | AdtDef::Union(it) => &it.syntax, | 3404 | AdtDef::Union(it) => &it.syntax, |
3405 | } | 3405 | } |
3406 | } | 3406 | } |
@@ -3470,7 +3470,7 @@ impl std::fmt::Display for ConstDef { | |||
3470 | std::fmt::Display::fmt(self.syntax(), f) | 3470 | std::fmt::Display::fmt(self.syntax(), f) |
3471 | } | 3471 | } |
3472 | } | 3472 | } |
3473 | impl std::fmt::Display for EnumDef { | 3473 | impl std::fmt::Display for Enum { |
3474 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3474 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3475 | std::fmt::Display::fmt(self.syntax(), f) | 3475 | std::fmt::Display::fmt(self.syntax(), f) |
3476 | } | 3476 | } |
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 2299988ce..02e6e52c2 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -248,11 +248,11 @@ impl ast::RecordFieldPat { | |||
248 | } | 248 | } |
249 | 249 | ||
250 | impl ast::EnumVariant { | 250 | impl ast::EnumVariant { |
251 | pub fn parent_enum(&self) -> ast::EnumDef { | 251 | pub fn parent_enum(&self) -> ast::Enum { |
252 | self.syntax() | 252 | self.syntax() |
253 | .parent() | 253 | .parent() |
254 | .and_then(|it| it.parent()) | 254 | .and_then(|it| it.parent()) |
255 | .and_then(ast::EnumDef::cast) | 255 | .and_then(ast::Enum::cast) |
256 | .expect("EnumVariants are always nested in Enums") | 256 | .expect("EnumVariants are always nested in Enums") |
257 | } | 257 | } |
258 | pub fn kind(&self) -> StructKind { | 258 | pub fn kind(&self) -> StructKind { |
@@ -479,7 +479,7 @@ impl ast::DocCommentsOwner for ast::Struct {} | |||
479 | impl ast::DocCommentsOwner for ast::Union {} | 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::Enum {} |
483 | impl ast::DocCommentsOwner for ast::EnumVariant {} | 483 | impl ast::DocCommentsOwner for ast::EnumVariant {} |
484 | impl ast::DocCommentsOwner for ast::TraitDef {} | 484 | impl ast::DocCommentsOwner for ast::TraitDef {} |
485 | impl ast::DocCommentsOwner for ast::Module {} | 485 | impl ast::DocCommentsOwner for ast::Module {} |