diff options
Diffstat (limited to 'crates/libsyntax2/src/ast')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 18 | ||||
-rw-r--r-- | crates/libsyntax2/src/ast/mod.rs | 5 |
2 files changed, 21 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index b347a05b4..13668b803 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -86,6 +86,24 @@ impl<R: TreeRoot> AstNode<R> for FnDef<R> { | |||
86 | impl<R: TreeRoot> ast::NameOwner<R> for FnDef<R> {} | 86 | impl<R: TreeRoot> ast::NameOwner<R> for FnDef<R> {} |
87 | impl<R: TreeRoot> FnDef<R> {} | 87 | impl<R: TreeRoot> FnDef<R> {} |
88 | 88 | ||
89 | // ImplItem | ||
90 | #[derive(Debug, Clone, Copy)] | ||
91 | pub struct ImplItem<R: TreeRoot = Arc<SyntaxRoot>> { | ||
92 | syntax: SyntaxNode<R>, | ||
93 | } | ||
94 | |||
95 | impl<R: TreeRoot> AstNode<R> for ImplItem<R> { | ||
96 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
97 | match syntax.kind() { | ||
98 | IMPL_ITEM => Some(ImplItem { syntax }), | ||
99 | _ => None, | ||
100 | } | ||
101 | } | ||
102 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
103 | } | ||
104 | |||
105 | impl<R: TreeRoot> ImplItem<R> {} | ||
106 | |||
89 | // Module | 107 | // Module |
90 | #[derive(Debug, Clone, Copy)] | 108 | #[derive(Debug, Clone, Copy)] |
91 | pub struct Module<R: TreeRoot = Arc<SyntaxRoot>> { | 109 | pub struct Module<R: TreeRoot = Arc<SyntaxRoot>> { |
diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 18a9f5d17..f001d340e 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs | |||
@@ -10,8 +10,9 @@ use { | |||
10 | }; | 10 | }; |
11 | pub use self::generated::*; | 11 | pub use self::generated::*; |
12 | 12 | ||
13 | pub trait AstNode<R: TreeRoot>: Sized { | 13 | pub trait AstNode<R: TreeRoot> { |
14 | fn cast(syntax: SyntaxNode<R>) -> Option<Self>; | 14 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> |
15 | where Self: Sized; | ||
15 | fn syntax(&self) -> &SyntaxNode<R>; | 16 | fn syntax(&self) -> &SyntaxNode<R>; |
16 | } | 17 | } |
17 | 18 | ||