diff options
author | Aleksey Kladov <[email protected]> | 2018-10-31 07:27:53 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-31 07:29:32 +0000 |
commit | 3068af79ffd23656ff2d46ac92d9192ce6c813fb (patch) | |
tree | bce803cd3f48489eee785c726fb09906f8a5f36a /crates/ra_syntax | |
parent | 032d15c392e8de7936c8729e03e6229313f3b054 (diff) |
Introduce owned ast nodes
ast::FooNode is an owned 'static counterpart to ast::Foo<'a>
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1289 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs.tera | 16 |
2 files changed, 1303 insertions, 2 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 096405a38..9ba775e1c 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -5,11 +5,24 @@ | |||
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | ast, | 7 | ast, |
8 | SyntaxNodeRef, AstNode, | 8 | SyntaxNode, SyntaxNodeRef, AstNode, |
9 | SyntaxKind::*, | 9 | SyntaxKind::*, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | // ArgList | 12 | // ArgList |
13 | |||
14 | #[derive(Debug, Clone)] | ||
15 | pub struct ArgListNode(SyntaxNode); | ||
16 | |||
17 | impl ArgListNode { | ||
18 | pub fn new(&self, ast: ArgList) -> ArgListNode { | ||
19 | let syntax = ast.syntax().owned(); | ||
20 | ArgListNode(syntax) | ||
21 | } | ||
22 | pub fn ast(&self) -> ArgList { | ||
23 | ArgList::cast(self.0.borrowed()).unwrap() | ||
24 | } | ||
25 | } | ||
13 | #[derive(Debug, Clone, Copy)] | 26 | #[derive(Debug, Clone, Copy)] |
14 | pub struct ArgList<'a> { | 27 | pub struct ArgList<'a> { |
15 | syntax: SyntaxNodeRef<'a>, | 28 | syntax: SyntaxNodeRef<'a>, |
@@ -32,6 +45,19 @@ impl<'a> ArgList<'a> { | |||
32 | } | 45 | } |
33 | 46 | ||
34 | // ArrayExpr | 47 | // ArrayExpr |
48 | |||
49 | #[derive(Debug, Clone)] | ||
50 | pub struct ArrayExprNode(SyntaxNode); | ||
51 | |||
52 | impl ArrayExprNode { | ||
53 | pub fn new(&self, ast: ArrayExpr) -> ArrayExprNode { | ||
54 | let syntax = ast.syntax().owned(); | ||
55 | ArrayExprNode(syntax) | ||
56 | } | ||
57 | pub fn ast(&self) -> ArrayExpr { | ||
58 | ArrayExpr::cast(self.0.borrowed()).unwrap() | ||
59 | } | ||
60 | } | ||
35 | #[derive(Debug, Clone, Copy)] | 61 | #[derive(Debug, Clone, Copy)] |
36 | pub struct ArrayExpr<'a> { | 62 | pub struct ArrayExpr<'a> { |
37 | syntax: SyntaxNodeRef<'a>, | 63 | syntax: SyntaxNodeRef<'a>, |
@@ -50,6 +76,19 @@ impl<'a> AstNode<'a> for ArrayExpr<'a> { | |||
50 | impl<'a> ArrayExpr<'a> {} | 76 | impl<'a> ArrayExpr<'a> {} |
51 | 77 | ||
52 | // ArrayType | 78 | // ArrayType |
79 | |||
80 | #[derive(Debug, Clone)] | ||
81 | pub struct ArrayTypeNode(SyntaxNode); | ||
82 | |||
83 | impl ArrayTypeNode { | ||
84 | pub fn new(&self, ast: ArrayType) -> ArrayTypeNode { | ||
85 | let syntax = ast.syntax().owned(); | ||
86 | ArrayTypeNode(syntax) | ||
87 | } | ||
88 | pub fn ast(&self) -> ArrayType { | ||
89 | ArrayType::cast(self.0.borrowed()).unwrap() | ||
90 | } | ||
91 | } | ||
53 | #[derive(Debug, Clone, Copy)] | 92 | #[derive(Debug, Clone, Copy)] |
54 | pub struct ArrayType<'a> { | 93 | pub struct ArrayType<'a> { |
55 | syntax: SyntaxNodeRef<'a>, | 94 | syntax: SyntaxNodeRef<'a>, |
@@ -68,6 +107,19 @@ impl<'a> AstNode<'a> for ArrayType<'a> { | |||
68 | impl<'a> ArrayType<'a> {} | 107 | impl<'a> ArrayType<'a> {} |
69 | 108 | ||
70 | // Attr | 109 | // Attr |
110 | |||
111 | #[derive(Debug, Clone)] | ||
112 | pub struct AttrNode(SyntaxNode); | ||
113 | |||
114 | impl AttrNode { | ||
115 | pub fn new(&self, ast: Attr) -> AttrNode { | ||
116 | let syntax = ast.syntax().owned(); | ||
117 | AttrNode(syntax) | ||
118 | } | ||
119 | pub fn ast(&self) -> Attr { | ||
120 | Attr::cast(self.0.borrowed()).unwrap() | ||
121 | } | ||
122 | } | ||
71 | #[derive(Debug, Clone, Copy)] | 123 | #[derive(Debug, Clone, Copy)] |
72 | pub struct Attr<'a> { | 124 | pub struct Attr<'a> { |
73 | syntax: SyntaxNodeRef<'a>, | 125 | syntax: SyntaxNodeRef<'a>, |
@@ -90,6 +142,19 @@ impl<'a> Attr<'a> { | |||
90 | } | 142 | } |
91 | 143 | ||
92 | // BinExpr | 144 | // BinExpr |
145 | |||
146 | #[derive(Debug, Clone)] | ||
147 | pub struct BinExprNode(SyntaxNode); | ||
148 | |||
149 | impl BinExprNode { | ||
150 | pub fn new(&self, ast: BinExpr) -> BinExprNode { | ||
151 | let syntax = ast.syntax().owned(); | ||
152 | BinExprNode(syntax) | ||
153 | } | ||
154 | pub fn ast(&self) -> BinExpr { | ||
155 | BinExpr::cast(self.0.borrowed()).unwrap() | ||
156 | } | ||
157 | } | ||
93 | #[derive(Debug, Clone, Copy)] | 158 | #[derive(Debug, Clone, Copy)] |
94 | pub struct BinExpr<'a> { | 159 | pub struct BinExpr<'a> { |
95 | syntax: SyntaxNodeRef<'a>, | 160 | syntax: SyntaxNodeRef<'a>, |
@@ -108,6 +173,19 @@ impl<'a> AstNode<'a> for BinExpr<'a> { | |||
108 | impl<'a> BinExpr<'a> {} | 173 | impl<'a> BinExpr<'a> {} |
109 | 174 | ||
110 | // BindPat | 175 | // BindPat |
176 | |||
177 | #[derive(Debug, Clone)] | ||
178 | pub struct BindPatNode(SyntaxNode); | ||
179 | |||
180 | impl BindPatNode { | ||
181 | pub fn new(&self, ast: BindPat) -> BindPatNode { | ||
182 | let syntax = ast.syntax().owned(); | ||
183 | BindPatNode(syntax) | ||
184 | } | ||
185 | pub fn ast(&self) -> BindPat { | ||
186 | BindPat::cast(self.0.borrowed()).unwrap() | ||
187 | } | ||
188 | } | ||
111 | #[derive(Debug, Clone, Copy)] | 189 | #[derive(Debug, Clone, Copy)] |
112 | pub struct BindPat<'a> { | 190 | pub struct BindPat<'a> { |
113 | syntax: SyntaxNodeRef<'a>, | 191 | syntax: SyntaxNodeRef<'a>, |
@@ -127,6 +205,19 @@ impl<'a> ast::NameOwner<'a> for BindPat<'a> {} | |||
127 | impl<'a> BindPat<'a> {} | 205 | impl<'a> BindPat<'a> {} |
128 | 206 | ||
129 | // Block | 207 | // Block |
208 | |||
209 | #[derive(Debug, Clone)] | ||
210 | pub struct BlockNode(SyntaxNode); | ||
211 | |||
212 | impl BlockNode { | ||
213 | pub fn new(&self, ast: Block) -> BlockNode { | ||
214 | let syntax = ast.syntax().owned(); | ||
215 | BlockNode(syntax) | ||
216 | } | ||
217 | pub fn ast(&self) -> Block { | ||
218 | Block::cast(self.0.borrowed()).unwrap() | ||
219 | } | ||
220 | } | ||
130 | #[derive(Debug, Clone, Copy)] | 221 | #[derive(Debug, Clone, Copy)] |
131 | pub struct Block<'a> { | 222 | pub struct Block<'a> { |
132 | syntax: SyntaxNodeRef<'a>, | 223 | syntax: SyntaxNodeRef<'a>, |
@@ -153,6 +244,19 @@ impl<'a> Block<'a> { | |||
153 | } | 244 | } |
154 | 245 | ||
155 | // BlockExpr | 246 | // BlockExpr |
247 | |||
248 | #[derive(Debug, Clone)] | ||
249 | pub struct BlockExprNode(SyntaxNode); | ||
250 | |||
251 | impl BlockExprNode { | ||
252 | pub fn new(&self, ast: BlockExpr) -> BlockExprNode { | ||
253 | let syntax = ast.syntax().owned(); | ||
254 | BlockExprNode(syntax) | ||
255 | } | ||
256 | pub fn ast(&self) -> BlockExpr { | ||
257 | BlockExpr::cast(self.0.borrowed()).unwrap() | ||
258 | } | ||
259 | } | ||
156 | #[derive(Debug, Clone, Copy)] | 260 | #[derive(Debug, Clone, Copy)] |
157 | pub struct BlockExpr<'a> { | 261 | pub struct BlockExpr<'a> { |
158 | syntax: SyntaxNodeRef<'a>, | 262 | syntax: SyntaxNodeRef<'a>, |
@@ -175,6 +279,19 @@ impl<'a> BlockExpr<'a> { | |||
175 | } | 279 | } |
176 | 280 | ||
177 | // BreakExpr | 281 | // BreakExpr |
282 | |||
283 | #[derive(Debug, Clone)] | ||
284 | pub struct BreakExprNode(SyntaxNode); | ||
285 | |||
286 | impl BreakExprNode { | ||
287 | pub fn new(&self, ast: BreakExpr) -> BreakExprNode { | ||
288 | let syntax = ast.syntax().owned(); | ||
289 | BreakExprNode(syntax) | ||
290 | } | ||
291 | pub fn ast(&self) -> BreakExpr { | ||
292 | BreakExpr::cast(self.0.borrowed()).unwrap() | ||
293 | } | ||
294 | } | ||
178 | #[derive(Debug, Clone, Copy)] | 295 | #[derive(Debug, Clone, Copy)] |
179 | pub struct BreakExpr<'a> { | 296 | pub struct BreakExpr<'a> { |
180 | syntax: SyntaxNodeRef<'a>, | 297 | syntax: SyntaxNodeRef<'a>, |
@@ -193,6 +310,19 @@ impl<'a> AstNode<'a> for BreakExpr<'a> { | |||
193 | impl<'a> BreakExpr<'a> {} | 310 | impl<'a> BreakExpr<'a> {} |
194 | 311 | ||
195 | // CallExpr | 312 | // CallExpr |
313 | |||
314 | #[derive(Debug, Clone)] | ||
315 | pub struct CallExprNode(SyntaxNode); | ||
316 | |||
317 | impl CallExprNode { | ||
318 | pub fn new(&self, ast: CallExpr) -> CallExprNode { | ||
319 | let syntax = ast.syntax().owned(); | ||
320 | CallExprNode(syntax) | ||
321 | } | ||
322 | pub fn ast(&self) -> CallExpr { | ||
323 | CallExpr::cast(self.0.borrowed()).unwrap() | ||
324 | } | ||
325 | } | ||
196 | #[derive(Debug, Clone, Copy)] | 326 | #[derive(Debug, Clone, Copy)] |
197 | pub struct CallExpr<'a> { | 327 | pub struct CallExpr<'a> { |
198 | syntax: SyntaxNodeRef<'a>, | 328 | syntax: SyntaxNodeRef<'a>, |
@@ -216,6 +346,19 @@ impl<'a> CallExpr<'a> { | |||
216 | } | 346 | } |
217 | 347 | ||
218 | // CastExpr | 348 | // CastExpr |
349 | |||
350 | #[derive(Debug, Clone)] | ||
351 | pub struct CastExprNode(SyntaxNode); | ||
352 | |||
353 | impl CastExprNode { | ||
354 | pub fn new(&self, ast: CastExpr) -> CastExprNode { | ||
355 | let syntax = ast.syntax().owned(); | ||
356 | CastExprNode(syntax) | ||
357 | } | ||
358 | pub fn ast(&self) -> CastExpr { | ||
359 | CastExpr::cast(self.0.borrowed()).unwrap() | ||
360 | } | ||
361 | } | ||
219 | #[derive(Debug, Clone, Copy)] | 362 | #[derive(Debug, Clone, Copy)] |
220 | pub struct CastExpr<'a> { | 363 | pub struct CastExpr<'a> { |
221 | syntax: SyntaxNodeRef<'a>, | 364 | syntax: SyntaxNodeRef<'a>, |
@@ -234,6 +377,19 @@ impl<'a> AstNode<'a> for CastExpr<'a> { | |||
234 | impl<'a> CastExpr<'a> {} | 377 | impl<'a> CastExpr<'a> {} |
235 | 378 | ||
236 | // Comment | 379 | // Comment |
380 | |||
381 | #[derive(Debug, Clone)] | ||
382 | pub struct CommentNode(SyntaxNode); | ||
383 | |||
384 | impl CommentNode { | ||
385 | pub fn new(&self, ast: Comment) -> CommentNode { | ||
386 | let syntax = ast.syntax().owned(); | ||
387 | CommentNode(syntax) | ||
388 | } | ||
389 | pub fn ast(&self) -> Comment { | ||
390 | Comment::cast(self.0.borrowed()).unwrap() | ||
391 | } | ||
392 | } | ||
237 | #[derive(Debug, Clone, Copy)] | 393 | #[derive(Debug, Clone, Copy)] |
238 | pub struct Comment<'a> { | 394 | pub struct Comment<'a> { |
239 | syntax: SyntaxNodeRef<'a>, | 395 | syntax: SyntaxNodeRef<'a>, |
@@ -252,6 +408,19 @@ impl<'a> AstNode<'a> for Comment<'a> { | |||
252 | impl<'a> Comment<'a> {} | 408 | impl<'a> Comment<'a> {} |
253 | 409 | ||
254 | // Condition | 410 | // Condition |
411 | |||
412 | #[derive(Debug, Clone)] | ||
413 | pub struct ConditionNode(SyntaxNode); | ||
414 | |||
415 | impl ConditionNode { | ||
416 | pub fn new(&self, ast: Condition) -> ConditionNode { | ||
417 | let syntax = ast.syntax().owned(); | ||
418 | ConditionNode(syntax) | ||
419 | } | ||
420 | pub fn ast(&self) -> Condition { | ||
421 | Condition::cast(self.0.borrowed()).unwrap() | ||
422 | } | ||
423 | } | ||
255 | #[derive(Debug, Clone, Copy)] | 424 | #[derive(Debug, Clone, Copy)] |
256 | pub struct Condition<'a> { | 425 | pub struct Condition<'a> { |
257 | syntax: SyntaxNodeRef<'a>, | 426 | syntax: SyntaxNodeRef<'a>, |
@@ -278,6 +447,19 @@ impl<'a> Condition<'a> { | |||
278 | } | 447 | } |
279 | 448 | ||
280 | // ConstDef | 449 | // ConstDef |
450 | |||
451 | #[derive(Debug, Clone)] | ||
452 | pub struct ConstDefNode(SyntaxNode); | ||
453 | |||
454 | impl ConstDefNode { | ||
455 | pub fn new(&self, ast: ConstDef) -> ConstDefNode { | ||
456 | let syntax = ast.syntax().owned(); | ||
457 | ConstDefNode(syntax) | ||
458 | } | ||
459 | pub fn ast(&self) -> ConstDef { | ||
460 | ConstDef::cast(self.0.borrowed()).unwrap() | ||
461 | } | ||
462 | } | ||
281 | #[derive(Debug, Clone, Copy)] | 463 | #[derive(Debug, Clone, Copy)] |
282 | pub struct ConstDef<'a> { | 464 | pub struct ConstDef<'a> { |
283 | syntax: SyntaxNodeRef<'a>, | 465 | syntax: SyntaxNodeRef<'a>, |
@@ -299,6 +481,19 @@ impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} | |||
299 | impl<'a> ConstDef<'a> {} | 481 | impl<'a> ConstDef<'a> {} |
300 | 482 | ||
301 | // ContinueExpr | 483 | // ContinueExpr |
484 | |||
485 | #[derive(Debug, Clone)] | ||
486 | pub struct ContinueExprNode(SyntaxNode); | ||
487 | |||
488 | impl ContinueExprNode { | ||
489 | pub fn new(&self, ast: ContinueExpr) -> ContinueExprNode { | ||
490 | let syntax = ast.syntax().owned(); | ||
491 | ContinueExprNode(syntax) | ||
492 | } | ||
493 | pub fn ast(&self) -> ContinueExpr { | ||
494 | ContinueExpr::cast(self.0.borrowed()).unwrap() | ||
495 | } | ||
496 | } | ||
302 | #[derive(Debug, Clone, Copy)] | 497 | #[derive(Debug, Clone, Copy)] |
303 | pub struct ContinueExpr<'a> { | 498 | pub struct ContinueExpr<'a> { |
304 | syntax: SyntaxNodeRef<'a>, | 499 | syntax: SyntaxNodeRef<'a>, |
@@ -317,6 +512,19 @@ impl<'a> AstNode<'a> for ContinueExpr<'a> { | |||
317 | impl<'a> ContinueExpr<'a> {} | 512 | impl<'a> ContinueExpr<'a> {} |
318 | 513 | ||
319 | // DynTraitType | 514 | // DynTraitType |
515 | |||
516 | #[derive(Debug, Clone)] | ||
517 | pub struct DynTraitTypeNode(SyntaxNode); | ||
518 | |||
519 | impl DynTraitTypeNode { | ||
520 | pub fn new(&self, ast: DynTraitType) -> DynTraitTypeNode { | ||
521 | let syntax = ast.syntax().owned(); | ||
522 | DynTraitTypeNode(syntax) | ||
523 | } | ||
524 | pub fn ast(&self) -> DynTraitType { | ||
525 | DynTraitType::cast(self.0.borrowed()).unwrap() | ||
526 | } | ||
527 | } | ||
320 | #[derive(Debug, Clone, Copy)] | 528 | #[derive(Debug, Clone, Copy)] |
321 | pub struct DynTraitType<'a> { | 529 | pub struct DynTraitType<'a> { |
322 | syntax: SyntaxNodeRef<'a>, | 530 | syntax: SyntaxNodeRef<'a>, |
@@ -335,6 +543,19 @@ impl<'a> AstNode<'a> for DynTraitType<'a> { | |||
335 | impl<'a> DynTraitType<'a> {} | 543 | impl<'a> DynTraitType<'a> {} |
336 | 544 | ||
337 | // EnumDef | 545 | // EnumDef |
546 | |||
547 | #[derive(Debug, Clone)] | ||
548 | pub struct EnumDefNode(SyntaxNode); | ||
549 | |||
550 | impl EnumDefNode { | ||
551 | pub fn new(&self, ast: EnumDef) -> EnumDefNode { | ||
552 | let syntax = ast.syntax().owned(); | ||
553 | EnumDefNode(syntax) | ||
554 | } | ||
555 | pub fn ast(&self) -> EnumDef { | ||
556 | EnumDef::cast(self.0.borrowed()).unwrap() | ||
557 | } | ||
558 | } | ||
338 | #[derive(Debug, Clone, Copy)] | 559 | #[derive(Debug, Clone, Copy)] |
339 | pub struct EnumDef<'a> { | 560 | pub struct EnumDef<'a> { |
340 | syntax: SyntaxNodeRef<'a>, | 561 | syntax: SyntaxNodeRef<'a>, |
@@ -356,6 +577,19 @@ impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} | |||
356 | impl<'a> EnumDef<'a> {} | 577 | impl<'a> EnumDef<'a> {} |
357 | 578 | ||
358 | // Expr | 579 | // Expr |
580 | |||
581 | #[derive(Debug, Clone)] | ||
582 | pub struct ExprNode(SyntaxNode); | ||
583 | |||
584 | impl ExprNode { | ||
585 | pub fn new(&self, ast: Expr) -> ExprNode { | ||
586 | let syntax = ast.syntax().owned(); | ||
587 | ExprNode(syntax) | ||
588 | } | ||
589 | pub fn ast(&self) -> Expr { | ||
590 | Expr::cast(self.0.borrowed()).unwrap() | ||
591 | } | ||
592 | } | ||
359 | #[derive(Debug, Clone, Copy)] | 593 | #[derive(Debug, Clone, Copy)] |
360 | pub enum Expr<'a> { | 594 | pub enum Expr<'a> { |
361 | TupleExpr(TupleExpr<'a>), | 595 | TupleExpr(TupleExpr<'a>), |
@@ -471,6 +705,19 @@ impl<'a> AstNode<'a> for Expr<'a> { | |||
471 | impl<'a> Expr<'a> {} | 705 | impl<'a> Expr<'a> {} |
472 | 706 | ||
473 | // ExprStmt | 707 | // ExprStmt |
708 | |||
709 | #[derive(Debug, Clone)] | ||
710 | pub struct ExprStmtNode(SyntaxNode); | ||
711 | |||
712 | impl ExprStmtNode { | ||
713 | pub fn new(&self, ast: ExprStmt) -> ExprStmtNode { | ||
714 | let syntax = ast.syntax().owned(); | ||
715 | ExprStmtNode(syntax) | ||
716 | } | ||
717 | pub fn ast(&self) -> ExprStmt { | ||
718 | ExprStmt::cast(self.0.borrowed()).unwrap() | ||
719 | } | ||
720 | } | ||
474 | #[derive(Debug, Clone, Copy)] | 721 | #[derive(Debug, Clone, Copy)] |
475 | pub struct ExprStmt<'a> { | 722 | pub struct ExprStmt<'a> { |
476 | syntax: SyntaxNodeRef<'a>, | 723 | syntax: SyntaxNodeRef<'a>, |
@@ -493,6 +740,19 @@ impl<'a> ExprStmt<'a> { | |||
493 | } | 740 | } |
494 | 741 | ||
495 | // ExternCrateItem | 742 | // ExternCrateItem |
743 | |||
744 | #[derive(Debug, Clone)] | ||
745 | pub struct ExternCrateItemNode(SyntaxNode); | ||
746 | |||
747 | impl ExternCrateItemNode { | ||
748 | pub fn new(&self, ast: ExternCrateItem) -> ExternCrateItemNode { | ||
749 | let syntax = ast.syntax().owned(); | ||
750 | ExternCrateItemNode(syntax) | ||
751 | } | ||
752 | pub fn ast(&self) -> ExternCrateItem { | ||
753 | ExternCrateItem::cast(self.0.borrowed()).unwrap() | ||
754 | } | ||
755 | } | ||
496 | #[derive(Debug, Clone, Copy)] | 756 | #[derive(Debug, Clone, Copy)] |
497 | pub struct ExternCrateItem<'a> { | 757 | pub struct ExternCrateItem<'a> { |
498 | syntax: SyntaxNodeRef<'a>, | 758 | syntax: SyntaxNodeRef<'a>, |
@@ -511,6 +771,19 @@ impl<'a> AstNode<'a> for ExternCrateItem<'a> { | |||
511 | impl<'a> ExternCrateItem<'a> {} | 771 | impl<'a> ExternCrateItem<'a> {} |
512 | 772 | ||
513 | // FieldExpr | 773 | // FieldExpr |
774 | |||
775 | #[derive(Debug, Clone)] | ||
776 | pub struct FieldExprNode(SyntaxNode); | ||
777 | |||
778 | impl FieldExprNode { | ||
779 | pub fn new(&self, ast: FieldExpr) -> FieldExprNode { | ||
780 | let syntax = ast.syntax().owned(); | ||
781 | FieldExprNode(syntax) | ||
782 | } | ||
783 | pub fn ast(&self) -> FieldExpr { | ||
784 | FieldExpr::cast(self.0.borrowed()).unwrap() | ||
785 | } | ||
786 | } | ||
514 | #[derive(Debug, Clone, Copy)] | 787 | #[derive(Debug, Clone, Copy)] |
515 | pub struct FieldExpr<'a> { | 788 | pub struct FieldExpr<'a> { |
516 | syntax: SyntaxNodeRef<'a>, | 789 | syntax: SyntaxNodeRef<'a>, |
@@ -529,6 +802,19 @@ impl<'a> AstNode<'a> for FieldExpr<'a> { | |||
529 | impl<'a> FieldExpr<'a> {} | 802 | impl<'a> FieldExpr<'a> {} |
530 | 803 | ||
531 | // FieldPatList | 804 | // FieldPatList |
805 | |||
806 | #[derive(Debug, Clone)] | ||
807 | pub struct FieldPatListNode(SyntaxNode); | ||
808 | |||
809 | impl FieldPatListNode { | ||
810 | pub fn new(&self, ast: FieldPatList) -> FieldPatListNode { | ||
811 | let syntax = ast.syntax().owned(); | ||
812 | FieldPatListNode(syntax) | ||
813 | } | ||
814 | pub fn ast(&self) -> FieldPatList { | ||
815 | FieldPatList::cast(self.0.borrowed()).unwrap() | ||
816 | } | ||
817 | } | ||
532 | #[derive(Debug, Clone, Copy)] | 818 | #[derive(Debug, Clone, Copy)] |
533 | pub struct FieldPatList<'a> { | 819 | pub struct FieldPatList<'a> { |
534 | syntax: SyntaxNodeRef<'a>, | 820 | syntax: SyntaxNodeRef<'a>, |
@@ -547,6 +833,19 @@ impl<'a> AstNode<'a> for FieldPatList<'a> { | |||
547 | impl<'a> FieldPatList<'a> {} | 833 | impl<'a> FieldPatList<'a> {} |
548 | 834 | ||
549 | // FnDef | 835 | // FnDef |
836 | |||
837 | #[derive(Debug, Clone)] | ||
838 | pub struct FnDefNode(SyntaxNode); | ||
839 | |||
840 | impl FnDefNode { | ||
841 | pub fn new(&self, ast: FnDef) -> FnDefNode { | ||
842 | let syntax = ast.syntax().owned(); | ||
843 | FnDefNode(syntax) | ||
844 | } | ||
845 | pub fn ast(&self) -> FnDef { | ||
846 | FnDef::cast(self.0.borrowed()).unwrap() | ||
847 | } | ||
848 | } | ||
550 | #[derive(Debug, Clone, Copy)] | 849 | #[derive(Debug, Clone, Copy)] |
551 | pub struct FnDef<'a> { | 850 | pub struct FnDef<'a> { |
552 | syntax: SyntaxNodeRef<'a>, | 851 | syntax: SyntaxNodeRef<'a>, |
@@ -580,6 +879,19 @@ impl<'a> FnDef<'a> { | |||
580 | } | 879 | } |
581 | 880 | ||
582 | // FnPointerType | 881 | // FnPointerType |
882 | |||
883 | #[derive(Debug, Clone)] | ||
884 | pub struct FnPointerTypeNode(SyntaxNode); | ||
885 | |||
886 | impl FnPointerTypeNode { | ||
887 | pub fn new(&self, ast: FnPointerType) -> FnPointerTypeNode { | ||
888 | let syntax = ast.syntax().owned(); | ||
889 | FnPointerTypeNode(syntax) | ||
890 | } | ||
891 | pub fn ast(&self) -> FnPointerType { | ||
892 | FnPointerType::cast(self.0.borrowed()).unwrap() | ||
893 | } | ||
894 | } | ||
583 | #[derive(Debug, Clone, Copy)] | 895 | #[derive(Debug, Clone, Copy)] |
584 | pub struct FnPointerType<'a> { | 896 | pub struct FnPointerType<'a> { |
585 | syntax: SyntaxNodeRef<'a>, | 897 | syntax: SyntaxNodeRef<'a>, |
@@ -598,6 +910,19 @@ impl<'a> AstNode<'a> for FnPointerType<'a> { | |||
598 | impl<'a> FnPointerType<'a> {} | 910 | impl<'a> FnPointerType<'a> {} |
599 | 911 | ||
600 | // ForExpr | 912 | // ForExpr |
913 | |||
914 | #[derive(Debug, Clone)] | ||
915 | pub struct ForExprNode(SyntaxNode); | ||
916 | |||
917 | impl ForExprNode { | ||
918 | pub fn new(&self, ast: ForExpr) -> ForExprNode { | ||
919 | let syntax = ast.syntax().owned(); | ||
920 | ForExprNode(syntax) | ||
921 | } | ||
922 | pub fn ast(&self) -> ForExpr { | ||
923 | ForExpr::cast(self.0.borrowed()).unwrap() | ||
924 | } | ||
925 | } | ||
601 | #[derive(Debug, Clone, Copy)] | 926 | #[derive(Debug, Clone, Copy)] |
602 | pub struct ForExpr<'a> { | 927 | pub struct ForExpr<'a> { |
603 | syntax: SyntaxNodeRef<'a>, | 928 | syntax: SyntaxNodeRef<'a>, |
@@ -625,6 +950,19 @@ impl<'a> ForExpr<'a> { | |||
625 | } | 950 | } |
626 | 951 | ||
627 | // ForType | 952 | // ForType |
953 | |||
954 | #[derive(Debug, Clone)] | ||
955 | pub struct ForTypeNode(SyntaxNode); | ||
956 | |||
957 | impl ForTypeNode { | ||
958 | pub fn new(&self, ast: ForType) -> ForTypeNode { | ||
959 | let syntax = ast.syntax().owned(); | ||
960 | ForTypeNode(syntax) | ||
961 | } | ||
962 | pub fn ast(&self) -> ForType { | ||
963 | ForType::cast(self.0.borrowed()).unwrap() | ||
964 | } | ||
965 | } | ||
628 | #[derive(Debug, Clone, Copy)] | 966 | #[derive(Debug, Clone, Copy)] |
629 | pub struct ForType<'a> { | 967 | pub struct ForType<'a> { |
630 | syntax: SyntaxNodeRef<'a>, | 968 | syntax: SyntaxNodeRef<'a>, |
@@ -643,6 +981,19 @@ impl<'a> AstNode<'a> for ForType<'a> { | |||
643 | impl<'a> ForType<'a> {} | 981 | impl<'a> ForType<'a> {} |
644 | 982 | ||
645 | // IfExpr | 983 | // IfExpr |
984 | |||
985 | #[derive(Debug, Clone)] | ||
986 | pub struct IfExprNode(SyntaxNode); | ||
987 | |||
988 | impl IfExprNode { | ||
989 | pub fn new(&self, ast: IfExpr) -> IfExprNode { | ||
990 | let syntax = ast.syntax().owned(); | ||
991 | IfExprNode(syntax) | ||
992 | } | ||
993 | pub fn ast(&self) -> IfExpr { | ||
994 | IfExpr::cast(self.0.borrowed()).unwrap() | ||
995 | } | ||
996 | } | ||
646 | #[derive(Debug, Clone, Copy)] | 997 | #[derive(Debug, Clone, Copy)] |
647 | pub struct IfExpr<'a> { | 998 | pub struct IfExpr<'a> { |
648 | syntax: SyntaxNodeRef<'a>, | 999 | syntax: SyntaxNodeRef<'a>, |
@@ -665,6 +1016,19 @@ impl<'a> IfExpr<'a> { | |||
665 | } | 1016 | } |
666 | 1017 | ||
667 | // ImplItem | 1018 | // ImplItem |
1019 | |||
1020 | #[derive(Debug, Clone)] | ||
1021 | pub struct ImplItemNode(SyntaxNode); | ||
1022 | |||
1023 | impl ImplItemNode { | ||
1024 | pub fn new(&self, ast: ImplItem) -> ImplItemNode { | ||
1025 | let syntax = ast.syntax().owned(); | ||
1026 | ImplItemNode(syntax) | ||
1027 | } | ||
1028 | pub fn ast(&self) -> ImplItem { | ||
1029 | ImplItem::cast(self.0.borrowed()).unwrap() | ||
1030 | } | ||
1031 | } | ||
668 | #[derive(Debug, Clone, Copy)] | 1032 | #[derive(Debug, Clone, Copy)] |
669 | pub struct ImplItem<'a> { | 1033 | pub struct ImplItem<'a> { |
670 | syntax: SyntaxNodeRef<'a>, | 1034 | syntax: SyntaxNodeRef<'a>, |
@@ -683,6 +1047,19 @@ impl<'a> AstNode<'a> for ImplItem<'a> { | |||
683 | impl<'a> ImplItem<'a> {} | 1047 | impl<'a> ImplItem<'a> {} |
684 | 1048 | ||
685 | // ImplTraitType | 1049 | // ImplTraitType |
1050 | |||
1051 | #[derive(Debug, Clone)] | ||
1052 | pub struct ImplTraitTypeNode(SyntaxNode); | ||
1053 | |||
1054 | impl ImplTraitTypeNode { | ||
1055 | pub fn new(&self, ast: ImplTraitType) -> ImplTraitTypeNode { | ||
1056 | let syntax = ast.syntax().owned(); | ||
1057 | ImplTraitTypeNode(syntax) | ||
1058 | } | ||
1059 | pub fn ast(&self) -> ImplTraitType { | ||
1060 | ImplTraitType::cast(self.0.borrowed()).unwrap() | ||
1061 | } | ||
1062 | } | ||
686 | #[derive(Debug, Clone, Copy)] | 1063 | #[derive(Debug, Clone, Copy)] |
687 | pub struct ImplTraitType<'a> { | 1064 | pub struct ImplTraitType<'a> { |
688 | syntax: SyntaxNodeRef<'a>, | 1065 | syntax: SyntaxNodeRef<'a>, |
@@ -701,6 +1078,19 @@ impl<'a> AstNode<'a> for ImplTraitType<'a> { | |||
701 | impl<'a> ImplTraitType<'a> {} | 1078 | impl<'a> ImplTraitType<'a> {} |
702 | 1079 | ||
703 | // IndexExpr | 1080 | // IndexExpr |
1081 | |||
1082 | #[derive(Debug, Clone)] | ||
1083 | pub struct IndexExprNode(SyntaxNode); | ||
1084 | |||
1085 | impl IndexExprNode { | ||
1086 | pub fn new(&self, ast: IndexExpr) -> IndexExprNode { | ||
1087 | let syntax = ast.syntax().owned(); | ||
1088 | IndexExprNode(syntax) | ||
1089 | } | ||
1090 | pub fn ast(&self) -> IndexExpr { | ||
1091 | IndexExpr::cast(self.0.borrowed()).unwrap() | ||
1092 | } | ||
1093 | } | ||
704 | #[derive(Debug, Clone, Copy)] | 1094 | #[derive(Debug, Clone, Copy)] |
705 | pub struct IndexExpr<'a> { | 1095 | pub struct IndexExpr<'a> { |
706 | syntax: SyntaxNodeRef<'a>, | 1096 | syntax: SyntaxNodeRef<'a>, |
@@ -719,6 +1109,19 @@ impl<'a> AstNode<'a> for IndexExpr<'a> { | |||
719 | impl<'a> IndexExpr<'a> {} | 1109 | impl<'a> IndexExpr<'a> {} |
720 | 1110 | ||
721 | // ItemList | 1111 | // ItemList |
1112 | |||
1113 | #[derive(Debug, Clone)] | ||
1114 | pub struct ItemListNode(SyntaxNode); | ||
1115 | |||
1116 | impl ItemListNode { | ||
1117 | pub fn new(&self, ast: ItemList) -> ItemListNode { | ||
1118 | let syntax = ast.syntax().owned(); | ||
1119 | ItemListNode(syntax) | ||
1120 | } | ||
1121 | pub fn ast(&self) -> ItemList { | ||
1122 | ItemList::cast(self.0.borrowed()).unwrap() | ||
1123 | } | ||
1124 | } | ||
722 | #[derive(Debug, Clone, Copy)] | 1125 | #[derive(Debug, Clone, Copy)] |
723 | pub struct ItemList<'a> { | 1126 | pub struct ItemList<'a> { |
724 | syntax: SyntaxNodeRef<'a>, | 1127 | syntax: SyntaxNodeRef<'a>, |
@@ -739,6 +1142,19 @@ impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {} | |||
739 | impl<'a> ItemList<'a> {} | 1142 | impl<'a> ItemList<'a> {} |
740 | 1143 | ||
741 | // Label | 1144 | // Label |
1145 | |||
1146 | #[derive(Debug, Clone)] | ||
1147 | pub struct LabelNode(SyntaxNode); | ||
1148 | |||
1149 | impl LabelNode { | ||
1150 | pub fn new(&self, ast: Label) -> LabelNode { | ||
1151 | let syntax = ast.syntax().owned(); | ||
1152 | LabelNode(syntax) | ||
1153 | } | ||
1154 | pub fn ast(&self) -> Label { | ||
1155 | Label::cast(self.0.borrowed()).unwrap() | ||
1156 | } | ||
1157 | } | ||
742 | #[derive(Debug, Clone, Copy)] | 1158 | #[derive(Debug, Clone, Copy)] |
743 | pub struct Label<'a> { | 1159 | pub struct Label<'a> { |
744 | syntax: SyntaxNodeRef<'a>, | 1160 | syntax: SyntaxNodeRef<'a>, |
@@ -757,6 +1173,19 @@ impl<'a> AstNode<'a> for Label<'a> { | |||
757 | impl<'a> Label<'a> {} | 1173 | impl<'a> Label<'a> {} |
758 | 1174 | ||
759 | // LambdaExpr | 1175 | // LambdaExpr |
1176 | |||
1177 | #[derive(Debug, Clone)] | ||
1178 | pub struct LambdaExprNode(SyntaxNode); | ||
1179 | |||
1180 | impl LambdaExprNode { | ||
1181 | pub fn new(&self, ast: LambdaExpr) -> LambdaExprNode { | ||
1182 | let syntax = ast.syntax().owned(); | ||
1183 | LambdaExprNode(syntax) | ||
1184 | } | ||
1185 | pub fn ast(&self) -> LambdaExpr { | ||
1186 | LambdaExpr::cast(self.0.borrowed()).unwrap() | ||
1187 | } | ||
1188 | } | ||
760 | #[derive(Debug, Clone, Copy)] | 1189 | #[derive(Debug, Clone, Copy)] |
761 | pub struct LambdaExpr<'a> { | 1190 | pub struct LambdaExpr<'a> { |
762 | syntax: SyntaxNodeRef<'a>, | 1191 | syntax: SyntaxNodeRef<'a>, |
@@ -783,6 +1212,19 @@ impl<'a> LambdaExpr<'a> { | |||
783 | } | 1212 | } |
784 | 1213 | ||
785 | // LetStmt | 1214 | // LetStmt |
1215 | |||
1216 | #[derive(Debug, Clone)] | ||
1217 | pub struct LetStmtNode(SyntaxNode); | ||
1218 | |||
1219 | impl LetStmtNode { | ||
1220 | pub fn new(&self, ast: LetStmt) -> LetStmtNode { | ||
1221 | let syntax = ast.syntax().owned(); | ||
1222 | LetStmtNode(syntax) | ||
1223 | } | ||
1224 | pub fn ast(&self) -> LetStmt { | ||
1225 | LetStmt::cast(self.0.borrowed()).unwrap() | ||
1226 | } | ||
1227 | } | ||
786 | #[derive(Debug, Clone, Copy)] | 1228 | #[derive(Debug, Clone, Copy)] |
787 | pub struct LetStmt<'a> { | 1229 | pub struct LetStmt<'a> { |
788 | syntax: SyntaxNodeRef<'a>, | 1230 | syntax: SyntaxNodeRef<'a>, |
@@ -809,6 +1251,19 @@ impl<'a> LetStmt<'a> { | |||
809 | } | 1251 | } |
810 | 1252 | ||
811 | // Lifetime | 1253 | // Lifetime |
1254 | |||
1255 | #[derive(Debug, Clone)] | ||
1256 | pub struct LifetimeNode(SyntaxNode); | ||
1257 | |||
1258 | impl LifetimeNode { | ||
1259 | pub fn new(&self, ast: Lifetime) -> LifetimeNode { | ||
1260 | let syntax = ast.syntax().owned(); | ||
1261 | LifetimeNode(syntax) | ||
1262 | } | ||
1263 | pub fn ast(&self) -> Lifetime { | ||
1264 | Lifetime::cast(self.0.borrowed()).unwrap() | ||
1265 | } | ||
1266 | } | ||
812 | #[derive(Debug, Clone, Copy)] | 1267 | #[derive(Debug, Clone, Copy)] |
813 | pub struct Lifetime<'a> { | 1268 | pub struct Lifetime<'a> { |
814 | syntax: SyntaxNodeRef<'a>, | 1269 | syntax: SyntaxNodeRef<'a>, |
@@ -827,6 +1282,19 @@ impl<'a> AstNode<'a> for Lifetime<'a> { | |||
827 | impl<'a> Lifetime<'a> {} | 1282 | impl<'a> Lifetime<'a> {} |
828 | 1283 | ||
829 | // LifetimeParam | 1284 | // LifetimeParam |
1285 | |||
1286 | #[derive(Debug, Clone)] | ||
1287 | pub struct LifetimeParamNode(SyntaxNode); | ||
1288 | |||
1289 | impl LifetimeParamNode { | ||
1290 | pub fn new(&self, ast: LifetimeParam) -> LifetimeParamNode { | ||
1291 | let syntax = ast.syntax().owned(); | ||
1292 | LifetimeParamNode(syntax) | ||
1293 | } | ||
1294 | pub fn ast(&self) -> LifetimeParam { | ||
1295 | LifetimeParam::cast(self.0.borrowed()).unwrap() | ||
1296 | } | ||
1297 | } | ||
830 | #[derive(Debug, Clone, Copy)] | 1298 | #[derive(Debug, Clone, Copy)] |
831 | pub struct LifetimeParam<'a> { | 1299 | pub struct LifetimeParam<'a> { |
832 | syntax: SyntaxNodeRef<'a>, | 1300 | syntax: SyntaxNodeRef<'a>, |
@@ -849,6 +1317,19 @@ impl<'a> LifetimeParam<'a> { | |||
849 | } | 1317 | } |
850 | 1318 | ||
851 | // Literal | 1319 | // Literal |
1320 | |||
1321 | #[derive(Debug, Clone)] | ||
1322 | pub struct LiteralNode(SyntaxNode); | ||
1323 | |||
1324 | impl LiteralNode { | ||
1325 | pub fn new(&self, ast: Literal) -> LiteralNode { | ||
1326 | let syntax = ast.syntax().owned(); | ||
1327 | LiteralNode(syntax) | ||
1328 | } | ||
1329 | pub fn ast(&self) -> Literal { | ||
1330 | Literal::cast(self.0.borrowed()).unwrap() | ||
1331 | } | ||
1332 | } | ||
852 | #[derive(Debug, Clone, Copy)] | 1333 | #[derive(Debug, Clone, Copy)] |
853 | pub struct Literal<'a> { | 1334 | pub struct Literal<'a> { |
854 | syntax: SyntaxNodeRef<'a>, | 1335 | syntax: SyntaxNodeRef<'a>, |
@@ -867,6 +1348,19 @@ impl<'a> AstNode<'a> for Literal<'a> { | |||
867 | impl<'a> Literal<'a> {} | 1348 | impl<'a> Literal<'a> {} |
868 | 1349 | ||
869 | // LoopExpr | 1350 | // LoopExpr |
1351 | |||
1352 | #[derive(Debug, Clone)] | ||
1353 | pub struct LoopExprNode(SyntaxNode); | ||
1354 | |||
1355 | impl LoopExprNode { | ||
1356 | pub fn new(&self, ast: LoopExpr) -> LoopExprNode { | ||
1357 | let syntax = ast.syntax().owned(); | ||
1358 | LoopExprNode(syntax) | ||
1359 | } | ||
1360 | pub fn ast(&self) -> LoopExpr { | ||
1361 | LoopExpr::cast(self.0.borrowed()).unwrap() | ||
1362 | } | ||
1363 | } | ||
870 | #[derive(Debug, Clone, Copy)] | 1364 | #[derive(Debug, Clone, Copy)] |
871 | pub struct LoopExpr<'a> { | 1365 | pub struct LoopExpr<'a> { |
872 | syntax: SyntaxNodeRef<'a>, | 1366 | syntax: SyntaxNodeRef<'a>, |
@@ -886,6 +1380,19 @@ impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {} | |||
886 | impl<'a> LoopExpr<'a> {} | 1380 | impl<'a> LoopExpr<'a> {} |
887 | 1381 | ||
888 | // MatchArm | 1382 | // MatchArm |
1383 | |||
1384 | #[derive(Debug, Clone)] | ||
1385 | pub struct MatchArmNode(SyntaxNode); | ||
1386 | |||
1387 | impl MatchArmNode { | ||
1388 | pub fn new(&self, ast: MatchArm) -> MatchArmNode { | ||
1389 | let syntax = ast.syntax().owned(); | ||
1390 | MatchArmNode(syntax) | ||
1391 | } | ||
1392 | pub fn ast(&self) -> MatchArm { | ||
1393 | MatchArm::cast(self.0.borrowed()).unwrap() | ||
1394 | } | ||
1395 | } | ||
889 | #[derive(Debug, Clone, Copy)] | 1396 | #[derive(Debug, Clone, Copy)] |
890 | pub struct MatchArm<'a> { | 1397 | pub struct MatchArm<'a> { |
891 | syntax: SyntaxNodeRef<'a>, | 1398 | syntax: SyntaxNodeRef<'a>, |
@@ -916,6 +1423,19 @@ impl<'a> MatchArm<'a> { | |||
916 | } | 1423 | } |
917 | 1424 | ||
918 | // MatchArmList | 1425 | // MatchArmList |
1426 | |||
1427 | #[derive(Debug, Clone)] | ||
1428 | pub struct MatchArmListNode(SyntaxNode); | ||
1429 | |||
1430 | impl MatchArmListNode { | ||
1431 | pub fn new(&self, ast: MatchArmList) -> MatchArmListNode { | ||
1432 | let syntax = ast.syntax().owned(); | ||
1433 | MatchArmListNode(syntax) | ||
1434 | } | ||
1435 | pub fn ast(&self) -> MatchArmList { | ||
1436 | MatchArmList::cast(self.0.borrowed()).unwrap() | ||
1437 | } | ||
1438 | } | ||
919 | #[derive(Debug, Clone, Copy)] | 1439 | #[derive(Debug, Clone, Copy)] |
920 | pub struct MatchArmList<'a> { | 1440 | pub struct MatchArmList<'a> { |
921 | syntax: SyntaxNodeRef<'a>, | 1441 | syntax: SyntaxNodeRef<'a>, |
@@ -938,6 +1458,19 @@ impl<'a> MatchArmList<'a> { | |||
938 | } | 1458 | } |
939 | 1459 | ||
940 | // MatchExpr | 1460 | // MatchExpr |
1461 | |||
1462 | #[derive(Debug, Clone)] | ||
1463 | pub struct MatchExprNode(SyntaxNode); | ||
1464 | |||
1465 | impl MatchExprNode { | ||
1466 | pub fn new(&self, ast: MatchExpr) -> MatchExprNode { | ||
1467 | let syntax = ast.syntax().owned(); | ||
1468 | MatchExprNode(syntax) | ||
1469 | } | ||
1470 | pub fn ast(&self) -> MatchExpr { | ||
1471 | MatchExpr::cast(self.0.borrowed()).unwrap() | ||
1472 | } | ||
1473 | } | ||
941 | #[derive(Debug, Clone, Copy)] | 1474 | #[derive(Debug, Clone, Copy)] |
942 | pub struct MatchExpr<'a> { | 1475 | pub struct MatchExpr<'a> { |
943 | syntax: SyntaxNodeRef<'a>, | 1476 | syntax: SyntaxNodeRef<'a>, |
@@ -964,6 +1497,19 @@ impl<'a> MatchExpr<'a> { | |||
964 | } | 1497 | } |
965 | 1498 | ||
966 | // MatchGuard | 1499 | // MatchGuard |
1500 | |||
1501 | #[derive(Debug, Clone)] | ||
1502 | pub struct MatchGuardNode(SyntaxNode); | ||
1503 | |||
1504 | impl MatchGuardNode { | ||
1505 | pub fn new(&self, ast: MatchGuard) -> MatchGuardNode { | ||
1506 | let syntax = ast.syntax().owned(); | ||
1507 | MatchGuardNode(syntax) | ||
1508 | } | ||
1509 | pub fn ast(&self) -> MatchGuard { | ||
1510 | MatchGuard::cast(self.0.borrowed()).unwrap() | ||
1511 | } | ||
1512 | } | ||
967 | #[derive(Debug, Clone, Copy)] | 1513 | #[derive(Debug, Clone, Copy)] |
968 | pub struct MatchGuard<'a> { | 1514 | pub struct MatchGuard<'a> { |
969 | syntax: SyntaxNodeRef<'a>, | 1515 | syntax: SyntaxNodeRef<'a>, |
@@ -982,6 +1528,19 @@ impl<'a> AstNode<'a> for MatchGuard<'a> { | |||
982 | impl<'a> MatchGuard<'a> {} | 1528 | impl<'a> MatchGuard<'a> {} |
983 | 1529 | ||
984 | // MethodCallExpr | 1530 | // MethodCallExpr |
1531 | |||
1532 | #[derive(Debug, Clone)] | ||
1533 | pub struct MethodCallExprNode(SyntaxNode); | ||
1534 | |||
1535 | impl MethodCallExprNode { | ||
1536 | pub fn new(&self, ast: MethodCallExpr) -> MethodCallExprNode { | ||
1537 | let syntax = ast.syntax().owned(); | ||
1538 | MethodCallExprNode(syntax) | ||
1539 | } | ||
1540 | pub fn ast(&self) -> MethodCallExpr { | ||
1541 | MethodCallExpr::cast(self.0.borrowed()).unwrap() | ||
1542 | } | ||
1543 | } | ||
985 | #[derive(Debug, Clone, Copy)] | 1544 | #[derive(Debug, Clone, Copy)] |
986 | pub struct MethodCallExpr<'a> { | 1545 | pub struct MethodCallExpr<'a> { |
987 | syntax: SyntaxNodeRef<'a>, | 1546 | syntax: SyntaxNodeRef<'a>, |
@@ -1005,6 +1564,19 @@ impl<'a> MethodCallExpr<'a> { | |||
1005 | } | 1564 | } |
1006 | 1565 | ||
1007 | // Module | 1566 | // Module |
1567 | |||
1568 | #[derive(Debug, Clone)] | ||
1569 | pub struct ModuleNode(SyntaxNode); | ||
1570 | |||
1571 | impl ModuleNode { | ||
1572 | pub fn new(&self, ast: Module) -> ModuleNode { | ||
1573 | let syntax = ast.syntax().owned(); | ||
1574 | ModuleNode(syntax) | ||
1575 | } | ||
1576 | pub fn ast(&self) -> Module { | ||
1577 | Module::cast(self.0.borrowed()).unwrap() | ||
1578 | } | ||
1579 | } | ||
1008 | #[derive(Debug, Clone, Copy)] | 1580 | #[derive(Debug, Clone, Copy)] |
1009 | pub struct Module<'a> { | 1581 | pub struct Module<'a> { |
1010 | syntax: SyntaxNodeRef<'a>, | 1582 | syntax: SyntaxNodeRef<'a>, |
@@ -1029,6 +1601,19 @@ impl<'a> Module<'a> { | |||
1029 | } | 1601 | } |
1030 | 1602 | ||
1031 | // ModuleItem | 1603 | // ModuleItem |
1604 | |||
1605 | #[derive(Debug, Clone)] | ||
1606 | pub struct ModuleItemNode(SyntaxNode); | ||
1607 | |||
1608 | impl ModuleItemNode { | ||
1609 | pub fn new(&self, ast: ModuleItem) -> ModuleItemNode { | ||
1610 | let syntax = ast.syntax().owned(); | ||
1611 | ModuleItemNode(syntax) | ||
1612 | } | ||
1613 | pub fn ast(&self) -> ModuleItem { | ||
1614 | ModuleItem::cast(self.0.borrowed()).unwrap() | ||
1615 | } | ||
1616 | } | ||
1032 | #[derive(Debug, Clone, Copy)] | 1617 | #[derive(Debug, Clone, Copy)] |
1033 | pub enum ModuleItem<'a> { | 1618 | pub enum ModuleItem<'a> { |
1034 | StructDef(StructDef<'a>), | 1619 | StructDef(StructDef<'a>), |
@@ -1081,6 +1666,19 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
1081 | impl<'a> ModuleItem<'a> {} | 1666 | impl<'a> ModuleItem<'a> {} |
1082 | 1667 | ||
1083 | // Name | 1668 | // Name |
1669 | |||
1670 | #[derive(Debug, Clone)] | ||
1671 | pub struct NameNode(SyntaxNode); | ||
1672 | |||
1673 | impl NameNode { | ||
1674 | pub fn new(&self, ast: Name) -> NameNode { | ||
1675 | let syntax = ast.syntax().owned(); | ||
1676 | NameNode(syntax) | ||
1677 | } | ||
1678 | pub fn ast(&self) -> Name { | ||
1679 | Name::cast(self.0.borrowed()).unwrap() | ||
1680 | } | ||
1681 | } | ||
1084 | #[derive(Debug, Clone, Copy)] | 1682 | #[derive(Debug, Clone, Copy)] |
1085 | pub struct Name<'a> { | 1683 | pub struct Name<'a> { |
1086 | syntax: SyntaxNodeRef<'a>, | 1684 | syntax: SyntaxNodeRef<'a>, |
@@ -1099,6 +1697,19 @@ impl<'a> AstNode<'a> for Name<'a> { | |||
1099 | impl<'a> Name<'a> {} | 1697 | impl<'a> Name<'a> {} |
1100 | 1698 | ||
1101 | // NameRef | 1699 | // NameRef |
1700 | |||
1701 | #[derive(Debug, Clone)] | ||
1702 | pub struct NameRefNode(SyntaxNode); | ||
1703 | |||
1704 | impl NameRefNode { | ||
1705 | pub fn new(&self, ast: NameRef) -> NameRefNode { | ||
1706 | let syntax = ast.syntax().owned(); | ||
1707 | NameRefNode(syntax) | ||
1708 | } | ||
1709 | pub fn ast(&self) -> NameRef { | ||
1710 | NameRef::cast(self.0.borrowed()).unwrap() | ||
1711 | } | ||
1712 | } | ||
1102 | #[derive(Debug, Clone, Copy)] | 1713 | #[derive(Debug, Clone, Copy)] |
1103 | pub struct NameRef<'a> { | 1714 | pub struct NameRef<'a> { |
1104 | syntax: SyntaxNodeRef<'a>, | 1715 | syntax: SyntaxNodeRef<'a>, |
@@ -1117,6 +1728,19 @@ impl<'a> AstNode<'a> for NameRef<'a> { | |||
1117 | impl<'a> NameRef<'a> {} | 1728 | impl<'a> NameRef<'a> {} |
1118 | 1729 | ||
1119 | // NamedField | 1730 | // NamedField |
1731 | |||
1732 | #[derive(Debug, Clone)] | ||
1733 | pub struct NamedFieldNode(SyntaxNode); | ||
1734 | |||
1735 | impl NamedFieldNode { | ||
1736 | pub fn new(&self, ast: NamedField) -> NamedFieldNode { | ||
1737 | let syntax = ast.syntax().owned(); | ||
1738 | NamedFieldNode(syntax) | ||
1739 | } | ||
1740 | pub fn ast(&self) -> NamedField { | ||
1741 | NamedField::cast(self.0.borrowed()).unwrap() | ||
1742 | } | ||
1743 | } | ||
1120 | #[derive(Debug, Clone, Copy)] | 1744 | #[derive(Debug, Clone, Copy)] |
1121 | pub struct NamedField<'a> { | 1745 | pub struct NamedField<'a> { |
1122 | syntax: SyntaxNodeRef<'a>, | 1746 | syntax: SyntaxNodeRef<'a>, |
@@ -1135,6 +1759,19 @@ impl<'a> AstNode<'a> for NamedField<'a> { | |||
1135 | impl<'a> NamedField<'a> {} | 1759 | impl<'a> NamedField<'a> {} |
1136 | 1760 | ||
1137 | // NamedFieldDef | 1761 | // NamedFieldDef |
1762 | |||
1763 | #[derive(Debug, Clone)] | ||
1764 | pub struct NamedFieldDefNode(SyntaxNode); | ||
1765 | |||
1766 | impl NamedFieldDefNode { | ||
1767 | pub fn new(&self, ast: NamedFieldDef) -> NamedFieldDefNode { | ||
1768 | let syntax = ast.syntax().owned(); | ||
1769 | NamedFieldDefNode(syntax) | ||
1770 | } | ||
1771 | pub fn ast(&self) -> NamedFieldDef { | ||
1772 | NamedFieldDef::cast(self.0.borrowed()).unwrap() | ||
1773 | } | ||
1774 | } | ||
1138 | #[derive(Debug, Clone, Copy)] | 1775 | #[derive(Debug, Clone, Copy)] |
1139 | pub struct NamedFieldDef<'a> { | 1776 | pub struct NamedFieldDef<'a> { |
1140 | syntax: SyntaxNodeRef<'a>, | 1777 | syntax: SyntaxNodeRef<'a>, |
@@ -1155,6 +1792,19 @@ impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} | |||
1155 | impl<'a> NamedFieldDef<'a> {} | 1792 | impl<'a> NamedFieldDef<'a> {} |
1156 | 1793 | ||
1157 | // NamedFieldList | 1794 | // NamedFieldList |
1795 | |||
1796 | #[derive(Debug, Clone)] | ||
1797 | pub struct NamedFieldListNode(SyntaxNode); | ||
1798 | |||
1799 | impl NamedFieldListNode { | ||
1800 | pub fn new(&self, ast: NamedFieldList) -> NamedFieldListNode { | ||
1801 | let syntax = ast.syntax().owned(); | ||
1802 | NamedFieldListNode(syntax) | ||
1803 | } | ||
1804 | pub fn ast(&self) -> NamedFieldList { | ||
1805 | NamedFieldList::cast(self.0.borrowed()).unwrap() | ||
1806 | } | ||
1807 | } | ||
1158 | #[derive(Debug, Clone, Copy)] | 1808 | #[derive(Debug, Clone, Copy)] |
1159 | pub struct NamedFieldList<'a> { | 1809 | pub struct NamedFieldList<'a> { |
1160 | syntax: SyntaxNodeRef<'a>, | 1810 | syntax: SyntaxNodeRef<'a>, |
@@ -1173,6 +1823,19 @@ impl<'a> AstNode<'a> for NamedFieldList<'a> { | |||
1173 | impl<'a> NamedFieldList<'a> {} | 1823 | impl<'a> NamedFieldList<'a> {} |
1174 | 1824 | ||
1175 | // NeverType | 1825 | // NeverType |
1826 | |||
1827 | #[derive(Debug, Clone)] | ||
1828 | pub struct NeverTypeNode(SyntaxNode); | ||
1829 | |||
1830 | impl NeverTypeNode { | ||
1831 | pub fn new(&self, ast: NeverType) -> NeverTypeNode { | ||
1832 | let syntax = ast.syntax().owned(); | ||
1833 | NeverTypeNode(syntax) | ||
1834 | } | ||
1835 | pub fn ast(&self) -> NeverType { | ||
1836 | NeverType::cast(self.0.borrowed()).unwrap() | ||
1837 | } | ||
1838 | } | ||
1176 | #[derive(Debug, Clone, Copy)] | 1839 | #[derive(Debug, Clone, Copy)] |
1177 | pub struct NeverType<'a> { | 1840 | pub struct NeverType<'a> { |
1178 | syntax: SyntaxNodeRef<'a>, | 1841 | syntax: SyntaxNodeRef<'a>, |
@@ -1191,6 +1854,19 @@ impl<'a> AstNode<'a> for NeverType<'a> { | |||
1191 | impl<'a> NeverType<'a> {} | 1854 | impl<'a> NeverType<'a> {} |
1192 | 1855 | ||
1193 | // NominalDef | 1856 | // NominalDef |
1857 | |||
1858 | #[derive(Debug, Clone)] | ||
1859 | pub struct NominalDefNode(SyntaxNode); | ||
1860 | |||
1861 | impl NominalDefNode { | ||
1862 | pub fn new(&self, ast: NominalDef) -> NominalDefNode { | ||
1863 | let syntax = ast.syntax().owned(); | ||
1864 | NominalDefNode(syntax) | ||
1865 | } | ||
1866 | pub fn ast(&self) -> NominalDef { | ||
1867 | NominalDef::cast(self.0.borrowed()).unwrap() | ||
1868 | } | ||
1869 | } | ||
1194 | #[derive(Debug, Clone, Copy)] | 1870 | #[derive(Debug, Clone, Copy)] |
1195 | pub enum NominalDef<'a> { | 1871 | pub enum NominalDef<'a> { |
1196 | StructDef(StructDef<'a>), | 1872 | StructDef(StructDef<'a>), |
@@ -1219,6 +1895,19 @@ impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {} | |||
1219 | impl<'a> NominalDef<'a> {} | 1895 | impl<'a> NominalDef<'a> {} |
1220 | 1896 | ||
1221 | // Param | 1897 | // Param |
1898 | |||
1899 | #[derive(Debug, Clone)] | ||
1900 | pub struct ParamNode(SyntaxNode); | ||
1901 | |||
1902 | impl ParamNode { | ||
1903 | pub fn new(&self, ast: Param) -> ParamNode { | ||
1904 | let syntax = ast.syntax().owned(); | ||
1905 | ParamNode(syntax) | ||
1906 | } | ||
1907 | pub fn ast(&self) -> Param { | ||
1908 | Param::cast(self.0.borrowed()).unwrap() | ||
1909 | } | ||
1910 | } | ||
1222 | #[derive(Debug, Clone, Copy)] | 1911 | #[derive(Debug, Clone, Copy)] |
1223 | pub struct Param<'a> { | 1912 | pub struct Param<'a> { |
1224 | syntax: SyntaxNodeRef<'a>, | 1913 | syntax: SyntaxNodeRef<'a>, |
@@ -1241,6 +1930,19 @@ impl<'a> Param<'a> { | |||
1241 | } | 1930 | } |
1242 | 1931 | ||
1243 | // ParamList | 1932 | // ParamList |
1933 | |||
1934 | #[derive(Debug, Clone)] | ||
1935 | pub struct ParamListNode(SyntaxNode); | ||
1936 | |||
1937 | impl ParamListNode { | ||
1938 | pub fn new(&self, ast: ParamList) -> ParamListNode { | ||
1939 | let syntax = ast.syntax().owned(); | ||
1940 | ParamListNode(syntax) | ||
1941 | } | ||
1942 | pub fn ast(&self) -> ParamList { | ||
1943 | ParamList::cast(self.0.borrowed()).unwrap() | ||
1944 | } | ||
1945 | } | ||
1244 | #[derive(Debug, Clone, Copy)] | 1946 | #[derive(Debug, Clone, Copy)] |
1245 | pub struct ParamList<'a> { | 1947 | pub struct ParamList<'a> { |
1246 | syntax: SyntaxNodeRef<'a>, | 1948 | syntax: SyntaxNodeRef<'a>, |
@@ -1267,6 +1969,19 @@ impl<'a> ParamList<'a> { | |||
1267 | } | 1969 | } |
1268 | 1970 | ||
1269 | // ParenExpr | 1971 | // ParenExpr |
1972 | |||
1973 | #[derive(Debug, Clone)] | ||
1974 | pub struct ParenExprNode(SyntaxNode); | ||
1975 | |||
1976 | impl ParenExprNode { | ||
1977 | pub fn new(&self, ast: ParenExpr) -> ParenExprNode { | ||
1978 | let syntax = ast.syntax().owned(); | ||
1979 | ParenExprNode(syntax) | ||
1980 | } | ||
1981 | pub fn ast(&self) -> ParenExpr { | ||
1982 | ParenExpr::cast(self.0.borrowed()).unwrap() | ||
1983 | } | ||
1984 | } | ||
1270 | #[derive(Debug, Clone, Copy)] | 1985 | #[derive(Debug, Clone, Copy)] |
1271 | pub struct ParenExpr<'a> { | 1986 | pub struct ParenExpr<'a> { |
1272 | syntax: SyntaxNodeRef<'a>, | 1987 | syntax: SyntaxNodeRef<'a>, |
@@ -1285,6 +2000,19 @@ impl<'a> AstNode<'a> for ParenExpr<'a> { | |||
1285 | impl<'a> ParenExpr<'a> {} | 2000 | impl<'a> ParenExpr<'a> {} |
1286 | 2001 | ||
1287 | // ParenType | 2002 | // ParenType |
2003 | |||
2004 | #[derive(Debug, Clone)] | ||
2005 | pub struct ParenTypeNode(SyntaxNode); | ||
2006 | |||
2007 | impl ParenTypeNode { | ||
2008 | pub fn new(&self, ast: ParenType) -> ParenTypeNode { | ||
2009 | let syntax = ast.syntax().owned(); | ||
2010 | ParenTypeNode(syntax) | ||
2011 | } | ||
2012 | pub fn ast(&self) -> ParenType { | ||
2013 | ParenType::cast(self.0.borrowed()).unwrap() | ||
2014 | } | ||
2015 | } | ||
1288 | #[derive(Debug, Clone, Copy)] | 2016 | #[derive(Debug, Clone, Copy)] |
1289 | pub struct ParenType<'a> { | 2017 | pub struct ParenType<'a> { |
1290 | syntax: SyntaxNodeRef<'a>, | 2018 | syntax: SyntaxNodeRef<'a>, |
@@ -1303,6 +2031,19 @@ impl<'a> AstNode<'a> for ParenType<'a> { | |||
1303 | impl<'a> ParenType<'a> {} | 2031 | impl<'a> ParenType<'a> {} |
1304 | 2032 | ||
1305 | // Pat | 2033 | // Pat |
2034 | |||
2035 | #[derive(Debug, Clone)] | ||
2036 | pub struct PatNode(SyntaxNode); | ||
2037 | |||
2038 | impl PatNode { | ||
2039 | pub fn new(&self, ast: Pat) -> PatNode { | ||
2040 | let syntax = ast.syntax().owned(); | ||
2041 | PatNode(syntax) | ||
2042 | } | ||
2043 | pub fn ast(&self) -> Pat { | ||
2044 | Pat::cast(self.0.borrowed()).unwrap() | ||
2045 | } | ||
2046 | } | ||
1306 | #[derive(Debug, Clone, Copy)] | 2047 | #[derive(Debug, Clone, Copy)] |
1307 | pub enum Pat<'a> { | 2048 | pub enum Pat<'a> { |
1308 | RefPat(RefPat<'a>), | 2049 | RefPat(RefPat<'a>), |
@@ -1352,6 +2093,19 @@ impl<'a> AstNode<'a> for Pat<'a> { | |||
1352 | impl<'a> Pat<'a> {} | 2093 | impl<'a> Pat<'a> {} |
1353 | 2094 | ||
1354 | // Path | 2095 | // Path |
2096 | |||
2097 | #[derive(Debug, Clone)] | ||
2098 | pub struct PathNode(SyntaxNode); | ||
2099 | |||
2100 | impl PathNode { | ||
2101 | pub fn new(&self, ast: Path) -> PathNode { | ||
2102 | let syntax = ast.syntax().owned(); | ||
2103 | PathNode(syntax) | ||
2104 | } | ||
2105 | pub fn ast(&self) -> Path { | ||
2106 | Path::cast(self.0.borrowed()).unwrap() | ||
2107 | } | ||
2108 | } | ||
1355 | #[derive(Debug, Clone, Copy)] | 2109 | #[derive(Debug, Clone, Copy)] |
1356 | pub struct Path<'a> { | 2110 | pub struct Path<'a> { |
1357 | syntax: SyntaxNodeRef<'a>, | 2111 | syntax: SyntaxNodeRef<'a>, |
@@ -1378,6 +2132,19 @@ impl<'a> Path<'a> { | |||
1378 | } | 2132 | } |
1379 | 2133 | ||
1380 | // PathExpr | 2134 | // PathExpr |
2135 | |||
2136 | #[derive(Debug, Clone)] | ||
2137 | pub struct PathExprNode(SyntaxNode); | ||
2138 | |||
2139 | impl PathExprNode { | ||
2140 | pub fn new(&self, ast: PathExpr) -> PathExprNode { | ||
2141 | let syntax = ast.syntax().owned(); | ||
2142 | PathExprNode(syntax) | ||
2143 | } | ||
2144 | pub fn ast(&self) -> PathExpr { | ||
2145 | PathExpr::cast(self.0.borrowed()).unwrap() | ||
2146 | } | ||
2147 | } | ||
1381 | #[derive(Debug, Clone, Copy)] | 2148 | #[derive(Debug, Clone, Copy)] |
1382 | pub struct PathExpr<'a> { | 2149 | pub struct PathExpr<'a> { |
1383 | syntax: SyntaxNodeRef<'a>, | 2150 | syntax: SyntaxNodeRef<'a>, |
@@ -1400,6 +2167,19 @@ impl<'a> PathExpr<'a> { | |||
1400 | } | 2167 | } |
1401 | 2168 | ||
1402 | // PathPat | 2169 | // PathPat |
2170 | |||
2171 | #[derive(Debug, Clone)] | ||
2172 | pub struct PathPatNode(SyntaxNode); | ||
2173 | |||
2174 | impl PathPatNode { | ||
2175 | pub fn new(&self, ast: PathPat) -> PathPatNode { | ||
2176 | let syntax = ast.syntax().owned(); | ||
2177 | PathPatNode(syntax) | ||
2178 | } | ||
2179 | pub fn ast(&self) -> PathPat { | ||
2180 | PathPat::cast(self.0.borrowed()).unwrap() | ||
2181 | } | ||
2182 | } | ||
1403 | #[derive(Debug, Clone, Copy)] | 2183 | #[derive(Debug, Clone, Copy)] |
1404 | pub struct PathPat<'a> { | 2184 | pub struct PathPat<'a> { |
1405 | syntax: SyntaxNodeRef<'a>, | 2185 | syntax: SyntaxNodeRef<'a>, |
@@ -1418,6 +2198,19 @@ impl<'a> AstNode<'a> for PathPat<'a> { | |||
1418 | impl<'a> PathPat<'a> {} | 2198 | impl<'a> PathPat<'a> {} |
1419 | 2199 | ||
1420 | // PathSegment | 2200 | // PathSegment |
2201 | |||
2202 | #[derive(Debug, Clone)] | ||
2203 | pub struct PathSegmentNode(SyntaxNode); | ||
2204 | |||
2205 | impl PathSegmentNode { | ||
2206 | pub fn new(&self, ast: PathSegment) -> PathSegmentNode { | ||
2207 | let syntax = ast.syntax().owned(); | ||
2208 | PathSegmentNode(syntax) | ||
2209 | } | ||
2210 | pub fn ast(&self) -> PathSegment { | ||
2211 | PathSegment::cast(self.0.borrowed()).unwrap() | ||
2212 | } | ||
2213 | } | ||
1421 | #[derive(Debug, Clone, Copy)] | 2214 | #[derive(Debug, Clone, Copy)] |
1422 | pub struct PathSegment<'a> { | 2215 | pub struct PathSegment<'a> { |
1423 | syntax: SyntaxNodeRef<'a>, | 2216 | syntax: SyntaxNodeRef<'a>, |
@@ -1440,6 +2233,19 @@ impl<'a> PathSegment<'a> { | |||
1440 | } | 2233 | } |
1441 | 2234 | ||
1442 | // PathType | 2235 | // PathType |
2236 | |||
2237 | #[derive(Debug, Clone)] | ||
2238 | pub struct PathTypeNode(SyntaxNode); | ||
2239 | |||
2240 | impl PathTypeNode { | ||
2241 | pub fn new(&self, ast: PathType) -> PathTypeNode { | ||
2242 | let syntax = ast.syntax().owned(); | ||
2243 | PathTypeNode(syntax) | ||
2244 | } | ||
2245 | pub fn ast(&self) -> PathType { | ||
2246 | PathType::cast(self.0.borrowed()).unwrap() | ||
2247 | } | ||
2248 | } | ||
1443 | #[derive(Debug, Clone, Copy)] | 2249 | #[derive(Debug, Clone, Copy)] |
1444 | pub struct PathType<'a> { | 2250 | pub struct PathType<'a> { |
1445 | syntax: SyntaxNodeRef<'a>, | 2251 | syntax: SyntaxNodeRef<'a>, |
@@ -1458,6 +2264,19 @@ impl<'a> AstNode<'a> for PathType<'a> { | |||
1458 | impl<'a> PathType<'a> {} | 2264 | impl<'a> PathType<'a> {} |
1459 | 2265 | ||
1460 | // PlaceholderPat | 2266 | // PlaceholderPat |
2267 | |||
2268 | #[derive(Debug, Clone)] | ||
2269 | pub struct PlaceholderPatNode(SyntaxNode); | ||
2270 | |||
2271 | impl PlaceholderPatNode { | ||
2272 | pub fn new(&self, ast: PlaceholderPat) -> PlaceholderPatNode { | ||
2273 | let syntax = ast.syntax().owned(); | ||
2274 | PlaceholderPatNode(syntax) | ||
2275 | } | ||
2276 | pub fn ast(&self) -> PlaceholderPat { | ||
2277 | PlaceholderPat::cast(self.0.borrowed()).unwrap() | ||
2278 | } | ||
2279 | } | ||
1461 | #[derive(Debug, Clone, Copy)] | 2280 | #[derive(Debug, Clone, Copy)] |
1462 | pub struct PlaceholderPat<'a> { | 2281 | pub struct PlaceholderPat<'a> { |
1463 | syntax: SyntaxNodeRef<'a>, | 2282 | syntax: SyntaxNodeRef<'a>, |
@@ -1476,6 +2295,19 @@ impl<'a> AstNode<'a> for PlaceholderPat<'a> { | |||
1476 | impl<'a> PlaceholderPat<'a> {} | 2295 | impl<'a> PlaceholderPat<'a> {} |
1477 | 2296 | ||
1478 | // PlaceholderType | 2297 | // PlaceholderType |
2298 | |||
2299 | #[derive(Debug, Clone)] | ||
2300 | pub struct PlaceholderTypeNode(SyntaxNode); | ||
2301 | |||
2302 | impl PlaceholderTypeNode { | ||
2303 | pub fn new(&self, ast: PlaceholderType) -> PlaceholderTypeNode { | ||
2304 | let syntax = ast.syntax().owned(); | ||
2305 | PlaceholderTypeNode(syntax) | ||
2306 | } | ||
2307 | pub fn ast(&self) -> PlaceholderType { | ||
2308 | PlaceholderType::cast(self.0.borrowed()).unwrap() | ||
2309 | } | ||
2310 | } | ||
1479 | #[derive(Debug, Clone, Copy)] | 2311 | #[derive(Debug, Clone, Copy)] |
1480 | pub struct PlaceholderType<'a> { | 2312 | pub struct PlaceholderType<'a> { |
1481 | syntax: SyntaxNodeRef<'a>, | 2313 | syntax: SyntaxNodeRef<'a>, |
@@ -1494,6 +2326,19 @@ impl<'a> AstNode<'a> for PlaceholderType<'a> { | |||
1494 | impl<'a> PlaceholderType<'a> {} | 2326 | impl<'a> PlaceholderType<'a> {} |
1495 | 2327 | ||
1496 | // PointerType | 2328 | // PointerType |
2329 | |||
2330 | #[derive(Debug, Clone)] | ||
2331 | pub struct PointerTypeNode(SyntaxNode); | ||
2332 | |||
2333 | impl PointerTypeNode { | ||
2334 | pub fn new(&self, ast: PointerType) -> PointerTypeNode { | ||
2335 | let syntax = ast.syntax().owned(); | ||
2336 | PointerTypeNode(syntax) | ||
2337 | } | ||
2338 | pub fn ast(&self) -> PointerType { | ||
2339 | PointerType::cast(self.0.borrowed()).unwrap() | ||
2340 | } | ||
2341 | } | ||
1497 | #[derive(Debug, Clone, Copy)] | 2342 | #[derive(Debug, Clone, Copy)] |
1498 | pub struct PointerType<'a> { | 2343 | pub struct PointerType<'a> { |
1499 | syntax: SyntaxNodeRef<'a>, | 2344 | syntax: SyntaxNodeRef<'a>, |
@@ -1512,6 +2357,19 @@ impl<'a> AstNode<'a> for PointerType<'a> { | |||
1512 | impl<'a> PointerType<'a> {} | 2357 | impl<'a> PointerType<'a> {} |
1513 | 2358 | ||
1514 | // PrefixExpr | 2359 | // PrefixExpr |
2360 | |||
2361 | #[derive(Debug, Clone)] | ||
2362 | pub struct PrefixExprNode(SyntaxNode); | ||
2363 | |||
2364 | impl PrefixExprNode { | ||
2365 | pub fn new(&self, ast: PrefixExpr) -> PrefixExprNode { | ||
2366 | let syntax = ast.syntax().owned(); | ||
2367 | PrefixExprNode(syntax) | ||
2368 | } | ||
2369 | pub fn ast(&self) -> PrefixExpr { | ||
2370 | PrefixExpr::cast(self.0.borrowed()).unwrap() | ||
2371 | } | ||
2372 | } | ||
1515 | #[derive(Debug, Clone, Copy)] | 2373 | #[derive(Debug, Clone, Copy)] |
1516 | pub struct PrefixExpr<'a> { | 2374 | pub struct PrefixExpr<'a> { |
1517 | syntax: SyntaxNodeRef<'a>, | 2375 | syntax: SyntaxNodeRef<'a>, |
@@ -1530,6 +2388,19 @@ impl<'a> AstNode<'a> for PrefixExpr<'a> { | |||
1530 | impl<'a> PrefixExpr<'a> {} | 2388 | impl<'a> PrefixExpr<'a> {} |
1531 | 2389 | ||
1532 | // RangeExpr | 2390 | // RangeExpr |
2391 | |||
2392 | #[derive(Debug, Clone)] | ||
2393 | pub struct RangeExprNode(SyntaxNode); | ||
2394 | |||
2395 | impl RangeExprNode { | ||
2396 | pub fn new(&self, ast: RangeExpr) -> RangeExprNode { | ||
2397 | let syntax = ast.syntax().owned(); | ||
2398 | RangeExprNode(syntax) | ||
2399 | } | ||
2400 | pub fn ast(&self) -> RangeExpr { | ||
2401 | RangeExpr::cast(self.0.borrowed()).unwrap() | ||
2402 | } | ||
2403 | } | ||
1533 | #[derive(Debug, Clone, Copy)] | 2404 | #[derive(Debug, Clone, Copy)] |
1534 | pub struct RangeExpr<'a> { | 2405 | pub struct RangeExpr<'a> { |
1535 | syntax: SyntaxNodeRef<'a>, | 2406 | syntax: SyntaxNodeRef<'a>, |
@@ -1548,6 +2419,19 @@ impl<'a> AstNode<'a> for RangeExpr<'a> { | |||
1548 | impl<'a> RangeExpr<'a> {} | 2419 | impl<'a> RangeExpr<'a> {} |
1549 | 2420 | ||
1550 | // RangePat | 2421 | // RangePat |
2422 | |||
2423 | #[derive(Debug, Clone)] | ||
2424 | pub struct RangePatNode(SyntaxNode); | ||
2425 | |||
2426 | impl RangePatNode { | ||
2427 | pub fn new(&self, ast: RangePat) -> RangePatNode { | ||
2428 | let syntax = ast.syntax().owned(); | ||
2429 | RangePatNode(syntax) | ||
2430 | } | ||
2431 | pub fn ast(&self) -> RangePat { | ||
2432 | RangePat::cast(self.0.borrowed()).unwrap() | ||
2433 | } | ||
2434 | } | ||
1551 | #[derive(Debug, Clone, Copy)] | 2435 | #[derive(Debug, Clone, Copy)] |
1552 | pub struct RangePat<'a> { | 2436 | pub struct RangePat<'a> { |
1553 | syntax: SyntaxNodeRef<'a>, | 2437 | syntax: SyntaxNodeRef<'a>, |
@@ -1566,6 +2450,19 @@ impl<'a> AstNode<'a> for RangePat<'a> { | |||
1566 | impl<'a> RangePat<'a> {} | 2450 | impl<'a> RangePat<'a> {} |
1567 | 2451 | ||
1568 | // RefExpr | 2452 | // RefExpr |
2453 | |||
2454 | #[derive(Debug, Clone)] | ||
2455 | pub struct RefExprNode(SyntaxNode); | ||
2456 | |||
2457 | impl RefExprNode { | ||
2458 | pub fn new(&self, ast: RefExpr) -> RefExprNode { | ||
2459 | let syntax = ast.syntax().owned(); | ||
2460 | RefExprNode(syntax) | ||
2461 | } | ||
2462 | pub fn ast(&self) -> RefExpr { | ||
2463 | RefExpr::cast(self.0.borrowed()).unwrap() | ||
2464 | } | ||
2465 | } | ||
1569 | #[derive(Debug, Clone, Copy)] | 2466 | #[derive(Debug, Clone, Copy)] |
1570 | pub struct RefExpr<'a> { | 2467 | pub struct RefExpr<'a> { |
1571 | syntax: SyntaxNodeRef<'a>, | 2468 | syntax: SyntaxNodeRef<'a>, |
@@ -1584,6 +2481,19 @@ impl<'a> AstNode<'a> for RefExpr<'a> { | |||
1584 | impl<'a> RefExpr<'a> {} | 2481 | impl<'a> RefExpr<'a> {} |
1585 | 2482 | ||
1586 | // RefPat | 2483 | // RefPat |
2484 | |||
2485 | #[derive(Debug, Clone)] | ||
2486 | pub struct RefPatNode(SyntaxNode); | ||
2487 | |||
2488 | impl RefPatNode { | ||
2489 | pub fn new(&self, ast: RefPat) -> RefPatNode { | ||
2490 | let syntax = ast.syntax().owned(); | ||
2491 | RefPatNode(syntax) | ||
2492 | } | ||
2493 | pub fn ast(&self) -> RefPat { | ||
2494 | RefPat::cast(self.0.borrowed()).unwrap() | ||
2495 | } | ||
2496 | } | ||
1587 | #[derive(Debug, Clone, Copy)] | 2497 | #[derive(Debug, Clone, Copy)] |
1588 | pub struct RefPat<'a> { | 2498 | pub struct RefPat<'a> { |
1589 | syntax: SyntaxNodeRef<'a>, | 2499 | syntax: SyntaxNodeRef<'a>, |
@@ -1602,6 +2512,19 @@ impl<'a> AstNode<'a> for RefPat<'a> { | |||
1602 | impl<'a> RefPat<'a> {} | 2512 | impl<'a> RefPat<'a> {} |
1603 | 2513 | ||
1604 | // ReferenceType | 2514 | // ReferenceType |
2515 | |||
2516 | #[derive(Debug, Clone)] | ||
2517 | pub struct ReferenceTypeNode(SyntaxNode); | ||
2518 | |||
2519 | impl ReferenceTypeNode { | ||
2520 | pub fn new(&self, ast: ReferenceType) -> ReferenceTypeNode { | ||
2521 | let syntax = ast.syntax().owned(); | ||
2522 | ReferenceTypeNode(syntax) | ||
2523 | } | ||
2524 | pub fn ast(&self) -> ReferenceType { | ||
2525 | ReferenceType::cast(self.0.borrowed()).unwrap() | ||
2526 | } | ||
2527 | } | ||
1605 | #[derive(Debug, Clone, Copy)] | 2528 | #[derive(Debug, Clone, Copy)] |
1606 | pub struct ReferenceType<'a> { | 2529 | pub struct ReferenceType<'a> { |
1607 | syntax: SyntaxNodeRef<'a>, | 2530 | syntax: SyntaxNodeRef<'a>, |
@@ -1620,6 +2543,19 @@ impl<'a> AstNode<'a> for ReferenceType<'a> { | |||
1620 | impl<'a> ReferenceType<'a> {} | 2543 | impl<'a> ReferenceType<'a> {} |
1621 | 2544 | ||
1622 | // RetType | 2545 | // RetType |
2546 | |||
2547 | #[derive(Debug, Clone)] | ||
2548 | pub struct RetTypeNode(SyntaxNode); | ||
2549 | |||
2550 | impl RetTypeNode { | ||
2551 | pub fn new(&self, ast: RetType) -> RetTypeNode { | ||
2552 | let syntax = ast.syntax().owned(); | ||
2553 | RetTypeNode(syntax) | ||
2554 | } | ||
2555 | pub fn ast(&self) -> RetType { | ||
2556 | RetType::cast(self.0.borrowed()).unwrap() | ||
2557 | } | ||
2558 | } | ||
1623 | #[derive(Debug, Clone, Copy)] | 2559 | #[derive(Debug, Clone, Copy)] |
1624 | pub struct RetType<'a> { | 2560 | pub struct RetType<'a> { |
1625 | syntax: SyntaxNodeRef<'a>, | 2561 | syntax: SyntaxNodeRef<'a>, |
@@ -1638,6 +2574,19 @@ impl<'a> AstNode<'a> for RetType<'a> { | |||
1638 | impl<'a> RetType<'a> {} | 2574 | impl<'a> RetType<'a> {} |
1639 | 2575 | ||
1640 | // ReturnExpr | 2576 | // ReturnExpr |
2577 | |||
2578 | #[derive(Debug, Clone)] | ||
2579 | pub struct ReturnExprNode(SyntaxNode); | ||
2580 | |||
2581 | impl ReturnExprNode { | ||
2582 | pub fn new(&self, ast: ReturnExpr) -> ReturnExprNode { | ||
2583 | let syntax = ast.syntax().owned(); | ||
2584 | ReturnExprNode(syntax) | ||
2585 | } | ||
2586 | pub fn ast(&self) -> ReturnExpr { | ||
2587 | ReturnExpr::cast(self.0.borrowed()).unwrap() | ||
2588 | } | ||
2589 | } | ||
1641 | #[derive(Debug, Clone, Copy)] | 2590 | #[derive(Debug, Clone, Copy)] |
1642 | pub struct ReturnExpr<'a> { | 2591 | pub struct ReturnExpr<'a> { |
1643 | syntax: SyntaxNodeRef<'a>, | 2592 | syntax: SyntaxNodeRef<'a>, |
@@ -1656,6 +2605,19 @@ impl<'a> AstNode<'a> for ReturnExpr<'a> { | |||
1656 | impl<'a> ReturnExpr<'a> {} | 2605 | impl<'a> ReturnExpr<'a> {} |
1657 | 2606 | ||
1658 | // Root | 2607 | // Root |
2608 | |||
2609 | #[derive(Debug, Clone)] | ||
2610 | pub struct RootNode(SyntaxNode); | ||
2611 | |||
2612 | impl RootNode { | ||
2613 | pub fn new(&self, ast: Root) -> RootNode { | ||
2614 | let syntax = ast.syntax().owned(); | ||
2615 | RootNode(syntax) | ||
2616 | } | ||
2617 | pub fn ast(&self) -> Root { | ||
2618 | Root::cast(self.0.borrowed()).unwrap() | ||
2619 | } | ||
2620 | } | ||
1659 | #[derive(Debug, Clone, Copy)] | 2621 | #[derive(Debug, Clone, Copy)] |
1660 | pub struct Root<'a> { | 2622 | pub struct Root<'a> { |
1661 | syntax: SyntaxNodeRef<'a>, | 2623 | syntax: SyntaxNodeRef<'a>, |
@@ -1680,6 +2642,19 @@ impl<'a> Root<'a> { | |||
1680 | } | 2642 | } |
1681 | 2643 | ||
1682 | // SelfParam | 2644 | // SelfParam |
2645 | |||
2646 | #[derive(Debug, Clone)] | ||
2647 | pub struct SelfParamNode(SyntaxNode); | ||
2648 | |||
2649 | impl SelfParamNode { | ||
2650 | pub fn new(&self, ast: SelfParam) -> SelfParamNode { | ||
2651 | let syntax = ast.syntax().owned(); | ||
2652 | SelfParamNode(syntax) | ||
2653 | } | ||
2654 | pub fn ast(&self) -> SelfParam { | ||
2655 | SelfParam::cast(self.0.borrowed()).unwrap() | ||
2656 | } | ||
2657 | } | ||
1683 | #[derive(Debug, Clone, Copy)] | 2658 | #[derive(Debug, Clone, Copy)] |
1684 | pub struct SelfParam<'a> { | 2659 | pub struct SelfParam<'a> { |
1685 | syntax: SyntaxNodeRef<'a>, | 2660 | syntax: SyntaxNodeRef<'a>, |
@@ -1698,6 +2673,19 @@ impl<'a> AstNode<'a> for SelfParam<'a> { | |||
1698 | impl<'a> SelfParam<'a> {} | 2673 | impl<'a> SelfParam<'a> {} |
1699 | 2674 | ||
1700 | // SlicePat | 2675 | // SlicePat |
2676 | |||
2677 | #[derive(Debug, Clone)] | ||
2678 | pub struct SlicePatNode(SyntaxNode); | ||
2679 | |||
2680 | impl SlicePatNode { | ||
2681 | pub fn new(&self, ast: SlicePat) -> SlicePatNode { | ||
2682 | let syntax = ast.syntax().owned(); | ||
2683 | SlicePatNode(syntax) | ||
2684 | } | ||
2685 | pub fn ast(&self) -> SlicePat { | ||
2686 | SlicePat::cast(self.0.borrowed()).unwrap() | ||
2687 | } | ||
2688 | } | ||
1701 | #[derive(Debug, Clone, Copy)] | 2689 | #[derive(Debug, Clone, Copy)] |
1702 | pub struct SlicePat<'a> { | 2690 | pub struct SlicePat<'a> { |
1703 | syntax: SyntaxNodeRef<'a>, | 2691 | syntax: SyntaxNodeRef<'a>, |
@@ -1716,6 +2704,19 @@ impl<'a> AstNode<'a> for SlicePat<'a> { | |||
1716 | impl<'a> SlicePat<'a> {} | 2704 | impl<'a> SlicePat<'a> {} |
1717 | 2705 | ||
1718 | // SliceType | 2706 | // SliceType |
2707 | |||
2708 | #[derive(Debug, Clone)] | ||
2709 | pub struct SliceTypeNode(SyntaxNode); | ||
2710 | |||
2711 | impl SliceTypeNode { | ||
2712 | pub fn new(&self, ast: SliceType) -> SliceTypeNode { | ||
2713 | let syntax = ast.syntax().owned(); | ||
2714 | SliceTypeNode(syntax) | ||
2715 | } | ||
2716 | pub fn ast(&self) -> SliceType { | ||
2717 | SliceType::cast(self.0.borrowed()).unwrap() | ||
2718 | } | ||
2719 | } | ||
1719 | #[derive(Debug, Clone, Copy)] | 2720 | #[derive(Debug, Clone, Copy)] |
1720 | pub struct SliceType<'a> { | 2721 | pub struct SliceType<'a> { |
1721 | syntax: SyntaxNodeRef<'a>, | 2722 | syntax: SyntaxNodeRef<'a>, |
@@ -1734,6 +2735,19 @@ impl<'a> AstNode<'a> for SliceType<'a> { | |||
1734 | impl<'a> SliceType<'a> {} | 2735 | impl<'a> SliceType<'a> {} |
1735 | 2736 | ||
1736 | // StaticDef | 2737 | // StaticDef |
2738 | |||
2739 | #[derive(Debug, Clone)] | ||
2740 | pub struct StaticDefNode(SyntaxNode); | ||
2741 | |||
2742 | impl StaticDefNode { | ||
2743 | pub fn new(&self, ast: StaticDef) -> StaticDefNode { | ||
2744 | let syntax = ast.syntax().owned(); | ||
2745 | StaticDefNode(syntax) | ||
2746 | } | ||
2747 | pub fn ast(&self) -> StaticDef { | ||
2748 | StaticDef::cast(self.0.borrowed()).unwrap() | ||
2749 | } | ||
2750 | } | ||
1737 | #[derive(Debug, Clone, Copy)] | 2751 | #[derive(Debug, Clone, Copy)] |
1738 | pub struct StaticDef<'a> { | 2752 | pub struct StaticDef<'a> { |
1739 | syntax: SyntaxNodeRef<'a>, | 2753 | syntax: SyntaxNodeRef<'a>, |
@@ -1755,6 +2769,19 @@ impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {} | |||
1755 | impl<'a> StaticDef<'a> {} | 2769 | impl<'a> StaticDef<'a> {} |
1756 | 2770 | ||
1757 | // Stmt | 2771 | // Stmt |
2772 | |||
2773 | #[derive(Debug, Clone)] | ||
2774 | pub struct StmtNode(SyntaxNode); | ||
2775 | |||
2776 | impl StmtNode { | ||
2777 | pub fn new(&self, ast: Stmt) -> StmtNode { | ||
2778 | let syntax = ast.syntax().owned(); | ||
2779 | StmtNode(syntax) | ||
2780 | } | ||
2781 | pub fn ast(&self) -> Stmt { | ||
2782 | Stmt::cast(self.0.borrowed()).unwrap() | ||
2783 | } | ||
2784 | } | ||
1758 | #[derive(Debug, Clone, Copy)] | 2785 | #[derive(Debug, Clone, Copy)] |
1759 | pub enum Stmt<'a> { | 2786 | pub enum Stmt<'a> { |
1760 | ExprStmt(ExprStmt<'a>), | 2787 | ExprStmt(ExprStmt<'a>), |
@@ -1780,6 +2807,19 @@ impl<'a> AstNode<'a> for Stmt<'a> { | |||
1780 | impl<'a> Stmt<'a> {} | 2807 | impl<'a> Stmt<'a> {} |
1781 | 2808 | ||
1782 | // StructDef | 2809 | // StructDef |
2810 | |||
2811 | #[derive(Debug, Clone)] | ||
2812 | pub struct StructDefNode(SyntaxNode); | ||
2813 | |||
2814 | impl StructDefNode { | ||
2815 | pub fn new(&self, ast: StructDef) -> StructDefNode { | ||
2816 | let syntax = ast.syntax().owned(); | ||
2817 | StructDefNode(syntax) | ||
2818 | } | ||
2819 | pub fn ast(&self) -> StructDef { | ||
2820 | StructDef::cast(self.0.borrowed()).unwrap() | ||
2821 | } | ||
2822 | } | ||
1783 | #[derive(Debug, Clone, Copy)] | 2823 | #[derive(Debug, Clone, Copy)] |
1784 | pub struct StructDef<'a> { | 2824 | pub struct StructDef<'a> { |
1785 | syntax: SyntaxNodeRef<'a>, | 2825 | syntax: SyntaxNodeRef<'a>, |
@@ -1805,6 +2845,19 @@ impl<'a> StructDef<'a> { | |||
1805 | } | 2845 | } |
1806 | 2846 | ||
1807 | // StructLit | 2847 | // StructLit |
2848 | |||
2849 | #[derive(Debug, Clone)] | ||
2850 | pub struct StructLitNode(SyntaxNode); | ||
2851 | |||
2852 | impl StructLitNode { | ||
2853 | pub fn new(&self, ast: StructLit) -> StructLitNode { | ||
2854 | let syntax = ast.syntax().owned(); | ||
2855 | StructLitNode(syntax) | ||
2856 | } | ||
2857 | pub fn ast(&self) -> StructLit { | ||
2858 | StructLit::cast(self.0.borrowed()).unwrap() | ||
2859 | } | ||
2860 | } | ||
1808 | #[derive(Debug, Clone, Copy)] | 2861 | #[derive(Debug, Clone, Copy)] |
1809 | pub struct StructLit<'a> { | 2862 | pub struct StructLit<'a> { |
1810 | syntax: SyntaxNodeRef<'a>, | 2863 | syntax: SyntaxNodeRef<'a>, |
@@ -1823,6 +2876,19 @@ impl<'a> AstNode<'a> for StructLit<'a> { | |||
1823 | impl<'a> StructLit<'a> {} | 2876 | impl<'a> StructLit<'a> {} |
1824 | 2877 | ||
1825 | // StructPat | 2878 | // StructPat |
2879 | |||
2880 | #[derive(Debug, Clone)] | ||
2881 | pub struct StructPatNode(SyntaxNode); | ||
2882 | |||
2883 | impl StructPatNode { | ||
2884 | pub fn new(&self, ast: StructPat) -> StructPatNode { | ||
2885 | let syntax = ast.syntax().owned(); | ||
2886 | StructPatNode(syntax) | ||
2887 | } | ||
2888 | pub fn ast(&self) -> StructPat { | ||
2889 | StructPat::cast(self.0.borrowed()).unwrap() | ||
2890 | } | ||
2891 | } | ||
1826 | #[derive(Debug, Clone, Copy)] | 2892 | #[derive(Debug, Clone, Copy)] |
1827 | pub struct StructPat<'a> { | 2893 | pub struct StructPat<'a> { |
1828 | syntax: SyntaxNodeRef<'a>, | 2894 | syntax: SyntaxNodeRef<'a>, |
@@ -1841,6 +2907,19 @@ impl<'a> AstNode<'a> for StructPat<'a> { | |||
1841 | impl<'a> StructPat<'a> {} | 2907 | impl<'a> StructPat<'a> {} |
1842 | 2908 | ||
1843 | // TokenTree | 2909 | // TokenTree |
2910 | |||
2911 | #[derive(Debug, Clone)] | ||
2912 | pub struct TokenTreeNode(SyntaxNode); | ||
2913 | |||
2914 | impl TokenTreeNode { | ||
2915 | pub fn new(&self, ast: TokenTree) -> TokenTreeNode { | ||
2916 | let syntax = ast.syntax().owned(); | ||
2917 | TokenTreeNode(syntax) | ||
2918 | } | ||
2919 | pub fn ast(&self) -> TokenTree { | ||
2920 | TokenTree::cast(self.0.borrowed()).unwrap() | ||
2921 | } | ||
2922 | } | ||
1844 | #[derive(Debug, Clone, Copy)] | 2923 | #[derive(Debug, Clone, Copy)] |
1845 | pub struct TokenTree<'a> { | 2924 | pub struct TokenTree<'a> { |
1846 | syntax: SyntaxNodeRef<'a>, | 2925 | syntax: SyntaxNodeRef<'a>, |
@@ -1859,6 +2938,19 @@ impl<'a> AstNode<'a> for TokenTree<'a> { | |||
1859 | impl<'a> TokenTree<'a> {} | 2938 | impl<'a> TokenTree<'a> {} |
1860 | 2939 | ||
1861 | // TraitDef | 2940 | // TraitDef |
2941 | |||
2942 | #[derive(Debug, Clone)] | ||
2943 | pub struct TraitDefNode(SyntaxNode); | ||
2944 | |||
2945 | impl TraitDefNode { | ||
2946 | pub fn new(&self, ast: TraitDef) -> TraitDefNode { | ||
2947 | let syntax = ast.syntax().owned(); | ||
2948 | TraitDefNode(syntax) | ||
2949 | } | ||
2950 | pub fn ast(&self) -> TraitDef { | ||
2951 | TraitDef::cast(self.0.borrowed()).unwrap() | ||
2952 | } | ||
2953 | } | ||
1862 | #[derive(Debug, Clone, Copy)] | 2954 | #[derive(Debug, Clone, Copy)] |
1863 | pub struct TraitDef<'a> { | 2955 | pub struct TraitDef<'a> { |
1864 | syntax: SyntaxNodeRef<'a>, | 2956 | syntax: SyntaxNodeRef<'a>, |
@@ -1879,6 +2971,19 @@ impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} | |||
1879 | impl<'a> TraitDef<'a> {} | 2971 | impl<'a> TraitDef<'a> {} |
1880 | 2972 | ||
1881 | // TryExpr | 2973 | // TryExpr |
2974 | |||
2975 | #[derive(Debug, Clone)] | ||
2976 | pub struct TryExprNode(SyntaxNode); | ||
2977 | |||
2978 | impl TryExprNode { | ||
2979 | pub fn new(&self, ast: TryExpr) -> TryExprNode { | ||
2980 | let syntax = ast.syntax().owned(); | ||
2981 | TryExprNode(syntax) | ||
2982 | } | ||
2983 | pub fn ast(&self) -> TryExpr { | ||
2984 | TryExpr::cast(self.0.borrowed()).unwrap() | ||
2985 | } | ||
2986 | } | ||
1882 | #[derive(Debug, Clone, Copy)] | 2987 | #[derive(Debug, Clone, Copy)] |
1883 | pub struct TryExpr<'a> { | 2988 | pub struct TryExpr<'a> { |
1884 | syntax: SyntaxNodeRef<'a>, | 2989 | syntax: SyntaxNodeRef<'a>, |
@@ -1897,6 +3002,19 @@ impl<'a> AstNode<'a> for TryExpr<'a> { | |||
1897 | impl<'a> TryExpr<'a> {} | 3002 | impl<'a> TryExpr<'a> {} |
1898 | 3003 | ||
1899 | // TupleExpr | 3004 | // TupleExpr |
3005 | |||
3006 | #[derive(Debug, Clone)] | ||
3007 | pub struct TupleExprNode(SyntaxNode); | ||
3008 | |||
3009 | impl TupleExprNode { | ||
3010 | pub fn new(&self, ast: TupleExpr) -> TupleExprNode { | ||
3011 | let syntax = ast.syntax().owned(); | ||
3012 | TupleExprNode(syntax) | ||
3013 | } | ||
3014 | pub fn ast(&self) -> TupleExpr { | ||
3015 | TupleExpr::cast(self.0.borrowed()).unwrap() | ||
3016 | } | ||
3017 | } | ||
1900 | #[derive(Debug, Clone, Copy)] | 3018 | #[derive(Debug, Clone, Copy)] |
1901 | pub struct TupleExpr<'a> { | 3019 | pub struct TupleExpr<'a> { |
1902 | syntax: SyntaxNodeRef<'a>, | 3020 | syntax: SyntaxNodeRef<'a>, |
@@ -1915,6 +3033,19 @@ impl<'a> AstNode<'a> for TupleExpr<'a> { | |||
1915 | impl<'a> TupleExpr<'a> {} | 3033 | impl<'a> TupleExpr<'a> {} |
1916 | 3034 | ||
1917 | // TuplePat | 3035 | // TuplePat |
3036 | |||
3037 | #[derive(Debug, Clone)] | ||
3038 | pub struct TuplePatNode(SyntaxNode); | ||
3039 | |||
3040 | impl TuplePatNode { | ||
3041 | pub fn new(&self, ast: TuplePat) -> TuplePatNode { | ||
3042 | let syntax = ast.syntax().owned(); | ||
3043 | TuplePatNode(syntax) | ||
3044 | } | ||
3045 | pub fn ast(&self) -> TuplePat { | ||
3046 | TuplePat::cast(self.0.borrowed()).unwrap() | ||
3047 | } | ||
3048 | } | ||
1918 | #[derive(Debug, Clone, Copy)] | 3049 | #[derive(Debug, Clone, Copy)] |
1919 | pub struct TuplePat<'a> { | 3050 | pub struct TuplePat<'a> { |
1920 | syntax: SyntaxNodeRef<'a>, | 3051 | syntax: SyntaxNodeRef<'a>, |
@@ -1933,6 +3064,19 @@ impl<'a> AstNode<'a> for TuplePat<'a> { | |||
1933 | impl<'a> TuplePat<'a> {} | 3064 | impl<'a> TuplePat<'a> {} |
1934 | 3065 | ||
1935 | // TupleStructPat | 3066 | // TupleStructPat |
3067 | |||
3068 | #[derive(Debug, Clone)] | ||
3069 | pub struct TupleStructPatNode(SyntaxNode); | ||
3070 | |||
3071 | impl TupleStructPatNode { | ||
3072 | pub fn new(&self, ast: TupleStructPat) -> TupleStructPatNode { | ||
3073 | let syntax = ast.syntax().owned(); | ||
3074 | TupleStructPatNode(syntax) | ||
3075 | } | ||
3076 | pub fn ast(&self) -> TupleStructPat { | ||
3077 | TupleStructPat::cast(self.0.borrowed()).unwrap() | ||
3078 | } | ||
3079 | } | ||
1936 | #[derive(Debug, Clone, Copy)] | 3080 | #[derive(Debug, Clone, Copy)] |
1937 | pub struct TupleStructPat<'a> { | 3081 | pub struct TupleStructPat<'a> { |
1938 | syntax: SyntaxNodeRef<'a>, | 3082 | syntax: SyntaxNodeRef<'a>, |
@@ -1951,6 +3095,19 @@ impl<'a> AstNode<'a> for TupleStructPat<'a> { | |||
1951 | impl<'a> TupleStructPat<'a> {} | 3095 | impl<'a> TupleStructPat<'a> {} |
1952 | 3096 | ||
1953 | // TupleType | 3097 | // TupleType |
3098 | |||
3099 | #[derive(Debug, Clone)] | ||
3100 | pub struct TupleTypeNode(SyntaxNode); | ||
3101 | |||
3102 | impl TupleTypeNode { | ||
3103 | pub fn new(&self, ast: TupleType) -> TupleTypeNode { | ||
3104 | let syntax = ast.syntax().owned(); | ||
3105 | TupleTypeNode(syntax) | ||
3106 | } | ||
3107 | pub fn ast(&self) -> TupleType { | ||
3108 | TupleType::cast(self.0.borrowed()).unwrap() | ||
3109 | } | ||
3110 | } | ||
1954 | #[derive(Debug, Clone, Copy)] | 3111 | #[derive(Debug, Clone, Copy)] |
1955 | pub struct TupleType<'a> { | 3112 | pub struct TupleType<'a> { |
1956 | syntax: SyntaxNodeRef<'a>, | 3113 | syntax: SyntaxNodeRef<'a>, |
@@ -1969,6 +3126,19 @@ impl<'a> AstNode<'a> for TupleType<'a> { | |||
1969 | impl<'a> TupleType<'a> {} | 3126 | impl<'a> TupleType<'a> {} |
1970 | 3127 | ||
1971 | // TypeDef | 3128 | // TypeDef |
3129 | |||
3130 | #[derive(Debug, Clone)] | ||
3131 | pub struct TypeDefNode(SyntaxNode); | ||
3132 | |||
3133 | impl TypeDefNode { | ||
3134 | pub fn new(&self, ast: TypeDef) -> TypeDefNode { | ||
3135 | let syntax = ast.syntax().owned(); | ||
3136 | TypeDefNode(syntax) | ||
3137 | } | ||
3138 | pub fn ast(&self) -> TypeDef { | ||
3139 | TypeDef::cast(self.0.borrowed()).unwrap() | ||
3140 | } | ||
3141 | } | ||
1972 | #[derive(Debug, Clone, Copy)] | 3142 | #[derive(Debug, Clone, Copy)] |
1973 | pub struct TypeDef<'a> { | 3143 | pub struct TypeDef<'a> { |
1974 | syntax: SyntaxNodeRef<'a>, | 3144 | syntax: SyntaxNodeRef<'a>, |
@@ -1990,6 +3160,19 @@ impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {} | |||
1990 | impl<'a> TypeDef<'a> {} | 3160 | impl<'a> TypeDef<'a> {} |
1991 | 3161 | ||
1992 | // TypeParam | 3162 | // TypeParam |
3163 | |||
3164 | #[derive(Debug, Clone)] | ||
3165 | pub struct TypeParamNode(SyntaxNode); | ||
3166 | |||
3167 | impl TypeParamNode { | ||
3168 | pub fn new(&self, ast: TypeParam) -> TypeParamNode { | ||
3169 | let syntax = ast.syntax().owned(); | ||
3170 | TypeParamNode(syntax) | ||
3171 | } | ||
3172 | pub fn ast(&self) -> TypeParam { | ||
3173 | TypeParam::cast(self.0.borrowed()).unwrap() | ||
3174 | } | ||
3175 | } | ||
1993 | #[derive(Debug, Clone, Copy)] | 3176 | #[derive(Debug, Clone, Copy)] |
1994 | pub struct TypeParam<'a> { | 3177 | pub struct TypeParam<'a> { |
1995 | syntax: SyntaxNodeRef<'a>, | 3178 | syntax: SyntaxNodeRef<'a>, |
@@ -2009,6 +3192,19 @@ impl<'a> ast::NameOwner<'a> for TypeParam<'a> {} | |||
2009 | impl<'a> TypeParam<'a> {} | 3192 | impl<'a> TypeParam<'a> {} |
2010 | 3193 | ||
2011 | // TypeParamList | 3194 | // TypeParamList |
3195 | |||
3196 | #[derive(Debug, Clone)] | ||
3197 | pub struct TypeParamListNode(SyntaxNode); | ||
3198 | |||
3199 | impl TypeParamListNode { | ||
3200 | pub fn new(&self, ast: TypeParamList) -> TypeParamListNode { | ||
3201 | let syntax = ast.syntax().owned(); | ||
3202 | TypeParamListNode(syntax) | ||
3203 | } | ||
3204 | pub fn ast(&self) -> TypeParamList { | ||
3205 | TypeParamList::cast(self.0.borrowed()).unwrap() | ||
3206 | } | ||
3207 | } | ||
2012 | #[derive(Debug, Clone, Copy)] | 3208 | #[derive(Debug, Clone, Copy)] |
2013 | pub struct TypeParamList<'a> { | 3209 | pub struct TypeParamList<'a> { |
2014 | syntax: SyntaxNodeRef<'a>, | 3210 | syntax: SyntaxNodeRef<'a>, |
@@ -2035,6 +3231,19 @@ impl<'a> TypeParamList<'a> { | |||
2035 | } | 3231 | } |
2036 | 3232 | ||
2037 | // TypeRef | 3233 | // TypeRef |
3234 | |||
3235 | #[derive(Debug, Clone)] | ||
3236 | pub struct TypeRefNode(SyntaxNode); | ||
3237 | |||
3238 | impl TypeRefNode { | ||
3239 | pub fn new(&self, ast: TypeRef) -> TypeRefNode { | ||
3240 | let syntax = ast.syntax().owned(); | ||
3241 | TypeRefNode(syntax) | ||
3242 | } | ||
3243 | pub fn ast(&self) -> TypeRef { | ||
3244 | TypeRef::cast(self.0.borrowed()).unwrap() | ||
3245 | } | ||
3246 | } | ||
2038 | #[derive(Debug, Clone, Copy)] | 3247 | #[derive(Debug, Clone, Copy)] |
2039 | pub enum TypeRef<'a> { | 3248 | pub enum TypeRef<'a> { |
2040 | ParenType(ParenType<'a>), | 3249 | ParenType(ParenType<'a>), |
@@ -2093,6 +3302,19 @@ impl<'a> AstNode<'a> for TypeRef<'a> { | |||
2093 | impl<'a> TypeRef<'a> {} | 3302 | impl<'a> TypeRef<'a> {} |
2094 | 3303 | ||
2095 | // UseItem | 3304 | // UseItem |
3305 | |||
3306 | #[derive(Debug, Clone)] | ||
3307 | pub struct UseItemNode(SyntaxNode); | ||
3308 | |||
3309 | impl UseItemNode { | ||
3310 | pub fn new(&self, ast: UseItem) -> UseItemNode { | ||
3311 | let syntax = ast.syntax().owned(); | ||
3312 | UseItemNode(syntax) | ||
3313 | } | ||
3314 | pub fn ast(&self) -> UseItem { | ||
3315 | UseItem::cast(self.0.borrowed()).unwrap() | ||
3316 | } | ||
3317 | } | ||
2096 | #[derive(Debug, Clone, Copy)] | 3318 | #[derive(Debug, Clone, Copy)] |
2097 | pub struct UseItem<'a> { | 3319 | pub struct UseItem<'a> { |
2098 | syntax: SyntaxNodeRef<'a>, | 3320 | syntax: SyntaxNodeRef<'a>, |
@@ -2115,6 +3337,19 @@ impl<'a> UseItem<'a> { | |||
2115 | } | 3337 | } |
2116 | 3338 | ||
2117 | // UseTree | 3339 | // UseTree |
3340 | |||
3341 | #[derive(Debug, Clone)] | ||
3342 | pub struct UseTreeNode(SyntaxNode); | ||
3343 | |||
3344 | impl UseTreeNode { | ||
3345 | pub fn new(&self, ast: UseTree) -> UseTreeNode { | ||
3346 | let syntax = ast.syntax().owned(); | ||
3347 | UseTreeNode(syntax) | ||
3348 | } | ||
3349 | pub fn ast(&self) -> UseTree { | ||
3350 | UseTree::cast(self.0.borrowed()).unwrap() | ||
3351 | } | ||
3352 | } | ||
2118 | #[derive(Debug, Clone, Copy)] | 3353 | #[derive(Debug, Clone, Copy)] |
2119 | pub struct UseTree<'a> { | 3354 | pub struct UseTree<'a> { |
2120 | syntax: SyntaxNodeRef<'a>, | 3355 | syntax: SyntaxNodeRef<'a>, |
@@ -2141,6 +3376,19 @@ impl<'a> UseTree<'a> { | |||
2141 | } | 3376 | } |
2142 | 3377 | ||
2143 | // UseTreeList | 3378 | // UseTreeList |
3379 | |||
3380 | #[derive(Debug, Clone)] | ||
3381 | pub struct UseTreeListNode(SyntaxNode); | ||
3382 | |||
3383 | impl UseTreeListNode { | ||
3384 | pub fn new(&self, ast: UseTreeList) -> UseTreeListNode { | ||
3385 | let syntax = ast.syntax().owned(); | ||
3386 | UseTreeListNode(syntax) | ||
3387 | } | ||
3388 | pub fn ast(&self) -> UseTreeList { | ||
3389 | UseTreeList::cast(self.0.borrowed()).unwrap() | ||
3390 | } | ||
3391 | } | ||
2144 | #[derive(Debug, Clone, Copy)] | 3392 | #[derive(Debug, Clone, Copy)] |
2145 | pub struct UseTreeList<'a> { | 3393 | pub struct UseTreeList<'a> { |
2146 | syntax: SyntaxNodeRef<'a>, | 3394 | syntax: SyntaxNodeRef<'a>, |
@@ -2163,6 +3411,19 @@ impl<'a> UseTreeList<'a> { | |||
2163 | } | 3411 | } |
2164 | 3412 | ||
2165 | // WhereClause | 3413 | // WhereClause |
3414 | |||
3415 | #[derive(Debug, Clone)] | ||
3416 | pub struct WhereClauseNode(SyntaxNode); | ||
3417 | |||
3418 | impl WhereClauseNode { | ||
3419 | pub fn new(&self, ast: WhereClause) -> WhereClauseNode { | ||
3420 | let syntax = ast.syntax().owned(); | ||
3421 | WhereClauseNode(syntax) | ||
3422 | } | ||
3423 | pub fn ast(&self) -> WhereClause { | ||
3424 | WhereClause::cast(self.0.borrowed()).unwrap() | ||
3425 | } | ||
3426 | } | ||
2166 | #[derive(Debug, Clone, Copy)] | 3427 | #[derive(Debug, Clone, Copy)] |
2167 | pub struct WhereClause<'a> { | 3428 | pub struct WhereClause<'a> { |
2168 | syntax: SyntaxNodeRef<'a>, | 3429 | syntax: SyntaxNodeRef<'a>, |
@@ -2181,6 +3442,19 @@ impl<'a> AstNode<'a> for WhereClause<'a> { | |||
2181 | impl<'a> WhereClause<'a> {} | 3442 | impl<'a> WhereClause<'a> {} |
2182 | 3443 | ||
2183 | // WhileExpr | 3444 | // WhileExpr |
3445 | |||
3446 | #[derive(Debug, Clone)] | ||
3447 | pub struct WhileExprNode(SyntaxNode); | ||
3448 | |||
3449 | impl WhileExprNode { | ||
3450 | pub fn new(&self, ast: WhileExpr) -> WhileExprNode { | ||
3451 | let syntax = ast.syntax().owned(); | ||
3452 | WhileExprNode(syntax) | ||
3453 | } | ||
3454 | pub fn ast(&self) -> WhileExpr { | ||
3455 | WhileExpr::cast(self.0.borrowed()).unwrap() | ||
3456 | } | ||
3457 | } | ||
2184 | #[derive(Debug, Clone, Copy)] | 3458 | #[derive(Debug, Clone, Copy)] |
2185 | pub struct WhileExpr<'a> { | 3459 | pub struct WhileExpr<'a> { |
2186 | syntax: SyntaxNodeRef<'a>, | 3460 | syntax: SyntaxNodeRef<'a>, |
@@ -2204,6 +3478,19 @@ impl<'a> WhileExpr<'a> { | |||
2204 | } | 3478 | } |
2205 | 3479 | ||
2206 | // Whitespace | 3480 | // Whitespace |
3481 | |||
3482 | #[derive(Debug, Clone)] | ||
3483 | pub struct WhitespaceNode(SyntaxNode); | ||
3484 | |||
3485 | impl WhitespaceNode { | ||
3486 | pub fn new(&self, ast: Whitespace) -> WhitespaceNode { | ||
3487 | let syntax = ast.syntax().owned(); | ||
3488 | WhitespaceNode(syntax) | ||
3489 | } | ||
3490 | pub fn ast(&self) -> Whitespace { | ||
3491 | Whitespace::cast(self.0.borrowed()).unwrap() | ||
3492 | } | ||
3493 | } | ||
2207 | #[derive(Debug, Clone, Copy)] | 3494 | #[derive(Debug, Clone, Copy)] |
2208 | pub struct Whitespace<'a> { | 3495 | pub struct Whitespace<'a> { |
2209 | syntax: SyntaxNodeRef<'a>, | 3496 | syntax: SyntaxNodeRef<'a>, |
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> { |