aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-30 17:17:28 +0100
committerAleksey Kladov <[email protected]>2020-07-30 17:17:28 +0100
commitc83467796b6c7365ea4f41900d74444384a9e618 (patch)
tree6eb770e4c9751813cc0530e7c645fed8914eed12 /crates/ra_syntax/src/ast
parentb2cdb0b22631a66a00be25ba4b2e9c0b34ff426a (diff)
Finalize Trait grammar
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs32
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
2 files changed, 17 insertions, 17 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 00a70fce0..3adb6b2d4 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -169,15 +169,15 @@ impl Struct {
169 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } 169 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
170} 170}
171#[derive(Debug, Clone, PartialEq, Eq, Hash)] 171#[derive(Debug, Clone, PartialEq, Eq, Hash)]
172pub struct TraitDef { 172pub struct Trait {
173 pub(crate) syntax: SyntaxNode, 173 pub(crate) syntax: SyntaxNode,
174} 174}
175impl ast::AttrsOwner for TraitDef {} 175impl ast::AttrsOwner for Trait {}
176impl ast::NameOwner for TraitDef {} 176impl ast::NameOwner for Trait {}
177impl ast::VisibilityOwner for TraitDef {} 177impl ast::VisibilityOwner for Trait {}
178impl ast::GenericParamsOwner for TraitDef {} 178impl ast::GenericParamsOwner for Trait {}
179impl ast::TypeBoundsOwner for TraitDef {} 179impl ast::TypeBoundsOwner for Trait {}
180impl TraitDef { 180impl Trait {
181 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 181 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
182 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } 182 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
183 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } 183 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
@@ -1283,7 +1283,7 @@ pub enum Item {
1283 Module(Module), 1283 Module(Module),
1284 Static(Static), 1284 Static(Static),
1285 Struct(Struct), 1285 Struct(Struct),
1286 TraitDef(TraitDef), 1286 Trait(Trait),
1287 TypeAlias(TypeAlias), 1287 TypeAlias(TypeAlias),
1288 Union(Union), 1288 Union(Union),
1289 Use(Use), 1289 Use(Use),
@@ -1532,8 +1532,8 @@ impl AstNode for Struct {
1532 } 1532 }
1533 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1533 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1534} 1534}
1535impl AstNode for TraitDef { 1535impl AstNode for Trait {
1536 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } 1536 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT }
1537 fn cast(syntax: SyntaxNode) -> Option<Self> { 1537 fn cast(syntax: SyntaxNode) -> Option<Self> {
1538 if Self::can_cast(syntax.kind()) { 1538 if Self::can_cast(syntax.kind()) {
1539 Some(Self { syntax }) 1539 Some(Self { syntax })
@@ -2805,8 +2805,8 @@ impl From<Static> for Item {
2805impl From<Struct> for Item { 2805impl From<Struct> for Item {
2806 fn from(node: Struct) -> Item { Item::Struct(node) } 2806 fn from(node: Struct) -> Item { Item::Struct(node) }
2807} 2807}
2808impl From<TraitDef> for Item { 2808impl From<Trait> for Item {
2809 fn from(node: TraitDef) -> Item { Item::TraitDef(node) } 2809 fn from(node: Trait) -> Item { Item::Trait(node) }
2810} 2810}
2811impl From<TypeAlias> for Item { 2811impl From<TypeAlias> for Item {
2812 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } 2812 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
@@ -2821,7 +2821,7 @@ impl AstNode for Item {
2821 fn can_cast(kind: SyntaxKind) -> bool { 2821 fn can_cast(kind: SyntaxKind) -> bool {
2822 match kind { 2822 match kind {
2823 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE 2823 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE
2824 | STATIC | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, 2824 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
2825 _ => false, 2825 _ => false,
2826 } 2826 }
2827 } 2827 }
@@ -2837,7 +2837,7 @@ impl AstNode for Item {
2837 MODULE => Item::Module(Module { syntax }), 2837 MODULE => Item::Module(Module { syntax }),
2838 STATIC => Item::Static(Static { syntax }), 2838 STATIC => Item::Static(Static { syntax }),
2839 STRUCT => Item::Struct(Struct { syntax }), 2839 STRUCT => Item::Struct(Struct { syntax }),
2840 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), 2840 TRAIT => Item::Trait(Trait { syntax }),
2841 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), 2841 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
2842 UNION => Item::Union(Union { syntax }), 2842 UNION => Item::Union(Union { syntax }),
2843 USE => Item::Use(Use { syntax }), 2843 USE => Item::Use(Use { syntax }),
@@ -2857,7 +2857,7 @@ impl AstNode for Item {
2857 Item::Module(it) => &it.syntax, 2857 Item::Module(it) => &it.syntax,
2858 Item::Static(it) => &it.syntax, 2858 Item::Static(it) => &it.syntax,
2859 Item::Struct(it) => &it.syntax, 2859 Item::Struct(it) => &it.syntax,
2860 Item::TraitDef(it) => &it.syntax, 2860 Item::Trait(it) => &it.syntax,
2861 Item::TypeAlias(it) => &it.syntax, 2861 Item::TypeAlias(it) => &it.syntax,
2862 Item::Union(it) => &it.syntax, 2862 Item::Union(it) => &it.syntax,
2863 Item::Use(it) => &it.syntax, 2863 Item::Use(it) => &it.syntax,
@@ -3516,7 +3516,7 @@ impl std::fmt::Display for Struct {
3516 std::fmt::Display::fmt(self.syntax(), f) 3516 std::fmt::Display::fmt(self.syntax(), f)
3517 } 3517 }
3518} 3518}
3519impl std::fmt::Display for TraitDef { 3519impl std::fmt::Display for Trait {
3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3521 std::fmt::Display::fmt(self.syntax(), f) 3521 std::fmt::Display::fmt(self.syntax(), f)
3522 } 3522 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 4da1d5c11..a8d8955de 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -481,7 +481,7 @@ impl 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::Variant {} 483impl ast::DocCommentsOwner for ast::Variant {}
484impl ast::DocCommentsOwner for ast::TraitDef {} 484impl ast::DocCommentsOwner for ast::Trait {}
485impl ast::DocCommentsOwner for ast::Module {} 485impl ast::DocCommentsOwner for ast::Module {}
486impl ast::DocCommentsOwner for ast::Static {} 486impl ast::DocCommentsOwner for ast::Static {}
487impl ast::DocCommentsOwner for ast::Const {} 487impl ast::DocCommentsOwner for ast::Const {}