diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs.tera')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs.tera | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera index e1404deac..c61c3e80b 100644 --- a/crates/ra_syntax/src/ast/generated.rs.tera +++ b/crates/ra_syntax/src/ast/generated.rs.tera | |||
@@ -7,11 +7,25 @@ the below applies to the result of this template | |||
7 | 7 | ||
8 | use crate::{ | 8 | use crate::{ |
9 | ast, | 9 | ast, |
10 | SyntaxNodeRef, AstNode, | 10 | SyntaxNode, SyntaxNodeRef, AstNode, |
11 | SyntaxKind::*, | 11 | SyntaxKind::*, |
12 | }; | 12 | }; |
13 | {% for node, methods in ast %} | 13 | {% for node, methods in ast %} |
14 | // {{ node }} | 14 | // {{ node }} |
15 | |||
16 | #[derive(Debug, Clone)] | ||
17 | pub struct {{ node }}Node(SyntaxNode); | ||
18 | |||
19 | impl {{ node }}Node { | ||
20 | pub fn new(&self, ast: {{ node }}) -> {{ node }}Node { | ||
21 | let syntax = ast.syntax().owned(); | ||
22 | {{ node }}Node(syntax) | ||
23 | } | ||
24 | pub fn ast(&self) -> {{ node }} { | ||
25 | {{ node }}::cast(self.0.borrowed()).unwrap() | ||
26 | } | ||
27 | } | ||
28 | |||
15 | {%- if methods.enum %} | 29 | {%- if methods.enum %} |
16 | #[derive(Debug, Clone, Copy)] | 30 | #[derive(Debug, Clone, Copy)] |
17 | pub enum {{ node }}<'a> { | 31 | pub enum {{ node }}<'a> { |