aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-10-31 07:27:53 +0000
committerAleksey Kladov <[email protected]>2018-10-31 07:29:32 +0000
commit3068af79ffd23656ff2d46ac92d9192ce6c813fb (patch)
treebce803cd3f48489eee785c726fb09906f8a5f36a
parent032d15c392e8de7936c8729e03e6229313f3b054 (diff)
Introduce owned ast nodes
ast::FooNode is an owned 'static counterpart to ast::Foo<'a>
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1289
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera16
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
6use crate::{ 6use 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)]
15pub struct ArgListNode(SyntaxNode);
16
17impl 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)]
14pub struct ArgList<'a> { 27pub 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)]
50pub struct ArrayExprNode(SyntaxNode);
51
52impl 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)]
36pub struct ArrayExpr<'a> { 62pub struct ArrayExpr<'a> {
37 syntax: SyntaxNodeRef<'a>, 63 syntax: SyntaxNodeRef<'a>,
@@ -50,6 +76,19 @@ impl<'a> AstNode<'a> for ArrayExpr<'a> {
50impl<'a> ArrayExpr<'a> {} 76impl<'a> ArrayExpr<'a> {}
51 77
52// ArrayType 78// ArrayType
79
80#[derive(Debug, Clone)]
81pub struct ArrayTypeNode(SyntaxNode);
82
83impl 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)]
54pub struct ArrayType<'a> { 93pub struct ArrayType<'a> {
55 syntax: SyntaxNodeRef<'a>, 94 syntax: SyntaxNodeRef<'a>,
@@ -68,6 +107,19 @@ impl<'a> AstNode<'a> for ArrayType<'a> {
68impl<'a> ArrayType<'a> {} 107impl<'a> ArrayType<'a> {}
69 108
70// Attr 109// Attr
110
111#[derive(Debug, Clone)]
112pub struct AttrNode(SyntaxNode);
113
114impl 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)]
72pub struct Attr<'a> { 124pub 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)]
147pub struct BinExprNode(SyntaxNode);
148
149impl 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)]
94pub struct BinExpr<'a> { 159pub struct BinExpr<'a> {
95 syntax: SyntaxNodeRef<'a>, 160 syntax: SyntaxNodeRef<'a>,
@@ -108,6 +173,19 @@ impl<'a> AstNode<'a> for BinExpr<'a> {
108impl<'a> BinExpr<'a> {} 173impl<'a> BinExpr<'a> {}
109 174
110// BindPat 175// BindPat
176
177#[derive(Debug, Clone)]
178pub struct BindPatNode(SyntaxNode);
179
180impl 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)]
112pub struct BindPat<'a> { 190pub struct BindPat<'a> {
113 syntax: SyntaxNodeRef<'a>, 191 syntax: SyntaxNodeRef<'a>,
@@ -127,6 +205,19 @@ impl<'a> ast::NameOwner<'a> for BindPat<'a> {}
127impl<'a> BindPat<'a> {} 205impl<'a> BindPat<'a> {}
128 206
129// Block 207// Block
208
209#[derive(Debug, Clone)]
210pub struct BlockNode(SyntaxNode);
211
212impl 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)]
131pub struct Block<'a> { 222pub 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)]
249pub struct BlockExprNode(SyntaxNode);
250
251impl 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)]
157pub struct BlockExpr<'a> { 261pub 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)]
284pub struct BreakExprNode(SyntaxNode);
285
286impl 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)]
179pub struct BreakExpr<'a> { 296pub struct BreakExpr<'a> {
180 syntax: SyntaxNodeRef<'a>, 297 syntax: SyntaxNodeRef<'a>,
@@ -193,6 +310,19 @@ impl<'a> AstNode<'a> for BreakExpr<'a> {
193impl<'a> BreakExpr<'a> {} 310impl<'a> BreakExpr<'a> {}
194 311
195// CallExpr 312// CallExpr
313
314#[derive(Debug, Clone)]
315pub struct CallExprNode(SyntaxNode);
316
317impl 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)]
197pub struct CallExpr<'a> { 327pub 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)]
351pub struct CastExprNode(SyntaxNode);
352
353impl 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)]
220pub struct CastExpr<'a> { 363pub struct CastExpr<'a> {
221 syntax: SyntaxNodeRef<'a>, 364 syntax: SyntaxNodeRef<'a>,
@@ -234,6 +377,19 @@ impl<'a> AstNode<'a> for CastExpr<'a> {
234impl<'a> CastExpr<'a> {} 377impl<'a> CastExpr<'a> {}
235 378
236// Comment 379// Comment
380
381#[derive(Debug, Clone)]
382pub struct CommentNode(SyntaxNode);
383
384impl 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)]
238pub struct Comment<'a> { 394pub struct Comment<'a> {
239 syntax: SyntaxNodeRef<'a>, 395 syntax: SyntaxNodeRef<'a>,
@@ -252,6 +408,19 @@ impl<'a> AstNode<'a> for Comment<'a> {
252impl<'a> Comment<'a> {} 408impl<'a> Comment<'a> {}
253 409
254// Condition 410// Condition
411
412#[derive(Debug, Clone)]
413pub struct ConditionNode(SyntaxNode);
414
415impl 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)]
256pub struct Condition<'a> { 425pub 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)]
452pub struct ConstDefNode(SyntaxNode);
453
454impl 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)]
282pub struct ConstDef<'a> { 464pub struct ConstDef<'a> {
283 syntax: SyntaxNodeRef<'a>, 465 syntax: SyntaxNodeRef<'a>,
@@ -299,6 +481,19 @@ impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {}
299impl<'a> ConstDef<'a> {} 481impl<'a> ConstDef<'a> {}
300 482
301// ContinueExpr 483// ContinueExpr
484
485#[derive(Debug, Clone)]
486pub struct ContinueExprNode(SyntaxNode);
487
488impl 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)]
303pub struct ContinueExpr<'a> { 498pub struct ContinueExpr<'a> {
304 syntax: SyntaxNodeRef<'a>, 499 syntax: SyntaxNodeRef<'a>,
@@ -317,6 +512,19 @@ impl<'a> AstNode<'a> for ContinueExpr<'a> {
317impl<'a> ContinueExpr<'a> {} 512impl<'a> ContinueExpr<'a> {}
318 513
319// DynTraitType 514// DynTraitType
515
516#[derive(Debug, Clone)]
517pub struct DynTraitTypeNode(SyntaxNode);
518
519impl 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)]
321pub struct DynTraitType<'a> { 529pub struct DynTraitType<'a> {
322 syntax: SyntaxNodeRef<'a>, 530 syntax: SyntaxNodeRef<'a>,
@@ -335,6 +543,19 @@ impl<'a> AstNode<'a> for DynTraitType<'a> {
335impl<'a> DynTraitType<'a> {} 543impl<'a> DynTraitType<'a> {}
336 544
337// EnumDef 545// EnumDef
546
547#[derive(Debug, Clone)]
548pub struct EnumDefNode(SyntaxNode);
549
550impl 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)]
339pub struct EnumDef<'a> { 560pub struct EnumDef<'a> {
340 syntax: SyntaxNodeRef<'a>, 561 syntax: SyntaxNodeRef<'a>,
@@ -356,6 +577,19 @@ impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {}
356impl<'a> EnumDef<'a> {} 577impl<'a> EnumDef<'a> {}
357 578
358// Expr 579// Expr
580
581#[derive(Debug, Clone)]
582pub struct ExprNode(SyntaxNode);
583
584impl 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)]
360pub enum Expr<'a> { 594pub enum Expr<'a> {
361 TupleExpr(TupleExpr<'a>), 595 TupleExpr(TupleExpr<'a>),
@@ -471,6 +705,19 @@ impl<'a> AstNode<'a> for Expr<'a> {
471impl<'a> Expr<'a> {} 705impl<'a> Expr<'a> {}
472 706
473// ExprStmt 707// ExprStmt
708
709#[derive(Debug, Clone)]
710pub struct ExprStmtNode(SyntaxNode);
711
712impl 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)]
475pub struct ExprStmt<'a> { 722pub 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)]
745pub struct ExternCrateItemNode(SyntaxNode);
746
747impl 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)]
497pub struct ExternCrateItem<'a> { 757pub struct ExternCrateItem<'a> {
498 syntax: SyntaxNodeRef<'a>, 758 syntax: SyntaxNodeRef<'a>,
@@ -511,6 +771,19 @@ impl<'a> AstNode<'a> for ExternCrateItem<'a> {
511impl<'a> ExternCrateItem<'a> {} 771impl<'a> ExternCrateItem<'a> {}
512 772
513// FieldExpr 773// FieldExpr
774
775#[derive(Debug, Clone)]
776pub struct FieldExprNode(SyntaxNode);
777
778impl 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)]
515pub struct FieldExpr<'a> { 788pub struct FieldExpr<'a> {
516 syntax: SyntaxNodeRef<'a>, 789 syntax: SyntaxNodeRef<'a>,
@@ -529,6 +802,19 @@ impl<'a> AstNode<'a> for FieldExpr<'a> {
529impl<'a> FieldExpr<'a> {} 802impl<'a> FieldExpr<'a> {}
530 803
531// FieldPatList 804// FieldPatList
805
806#[derive(Debug, Clone)]
807pub struct FieldPatListNode(SyntaxNode);
808
809impl 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)]
533pub struct FieldPatList<'a> { 819pub struct FieldPatList<'a> {
534 syntax: SyntaxNodeRef<'a>, 820 syntax: SyntaxNodeRef<'a>,
@@ -547,6 +833,19 @@ impl<'a> AstNode<'a> for FieldPatList<'a> {
547impl<'a> FieldPatList<'a> {} 833impl<'a> FieldPatList<'a> {}
548 834
549// FnDef 835// FnDef
836
837#[derive(Debug, Clone)]
838pub struct FnDefNode(SyntaxNode);
839
840impl 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)]
551pub struct FnDef<'a> { 850pub 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)]
884pub struct FnPointerTypeNode(SyntaxNode);
885
886impl 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)]
584pub struct FnPointerType<'a> { 896pub struct FnPointerType<'a> {
585 syntax: SyntaxNodeRef<'a>, 897 syntax: SyntaxNodeRef<'a>,
@@ -598,6 +910,19 @@ impl<'a> AstNode<'a> for FnPointerType<'a> {
598impl<'a> FnPointerType<'a> {} 910impl<'a> FnPointerType<'a> {}
599 911
600// ForExpr 912// ForExpr
913
914#[derive(Debug, Clone)]
915pub struct ForExprNode(SyntaxNode);
916
917impl 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)]
602pub struct ForExpr<'a> { 927pub 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)]
955pub struct ForTypeNode(SyntaxNode);
956
957impl 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)]
629pub struct ForType<'a> { 967pub struct ForType<'a> {
630 syntax: SyntaxNodeRef<'a>, 968 syntax: SyntaxNodeRef<'a>,
@@ -643,6 +981,19 @@ impl<'a> AstNode<'a> for ForType<'a> {
643impl<'a> ForType<'a> {} 981impl<'a> ForType<'a> {}
644 982
645// IfExpr 983// IfExpr
984
985#[derive(Debug, Clone)]
986pub struct IfExprNode(SyntaxNode);
987
988impl 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)]
647pub struct IfExpr<'a> { 998pub 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)]
1021pub struct ImplItemNode(SyntaxNode);
1022
1023impl 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)]
669pub struct ImplItem<'a> { 1033pub struct ImplItem<'a> {
670 syntax: SyntaxNodeRef<'a>, 1034 syntax: SyntaxNodeRef<'a>,
@@ -683,6 +1047,19 @@ impl<'a> AstNode<'a> for ImplItem<'a> {
683impl<'a> ImplItem<'a> {} 1047impl<'a> ImplItem<'a> {}
684 1048
685// ImplTraitType 1049// ImplTraitType
1050
1051#[derive(Debug, Clone)]
1052pub struct ImplTraitTypeNode(SyntaxNode);
1053
1054impl 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)]
687pub struct ImplTraitType<'a> { 1064pub struct ImplTraitType<'a> {
688 syntax: SyntaxNodeRef<'a>, 1065 syntax: SyntaxNodeRef<'a>,
@@ -701,6 +1078,19 @@ impl<'a> AstNode<'a> for ImplTraitType<'a> {
701impl<'a> ImplTraitType<'a> {} 1078impl<'a> ImplTraitType<'a> {}
702 1079
703// IndexExpr 1080// IndexExpr
1081
1082#[derive(Debug, Clone)]
1083pub struct IndexExprNode(SyntaxNode);
1084
1085impl 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)]
705pub struct IndexExpr<'a> { 1095pub struct IndexExpr<'a> {
706 syntax: SyntaxNodeRef<'a>, 1096 syntax: SyntaxNodeRef<'a>,
@@ -719,6 +1109,19 @@ impl<'a> AstNode<'a> for IndexExpr<'a> {
719impl<'a> IndexExpr<'a> {} 1109impl<'a> IndexExpr<'a> {}
720 1110
721// ItemList 1111// ItemList
1112
1113#[derive(Debug, Clone)]
1114pub struct ItemListNode(SyntaxNode);
1115
1116impl 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)]
723pub struct ItemList<'a> { 1126pub struct ItemList<'a> {
724 syntax: SyntaxNodeRef<'a>, 1127 syntax: SyntaxNodeRef<'a>,
@@ -739,6 +1142,19 @@ impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {}
739impl<'a> ItemList<'a> {} 1142impl<'a> ItemList<'a> {}
740 1143
741// Label 1144// Label
1145
1146#[derive(Debug, Clone)]
1147pub struct LabelNode(SyntaxNode);
1148
1149impl 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)]
743pub struct Label<'a> { 1159pub struct Label<'a> {
744 syntax: SyntaxNodeRef<'a>, 1160 syntax: SyntaxNodeRef<'a>,
@@ -757,6 +1173,19 @@ impl<'a> AstNode<'a> for Label<'a> {
757impl<'a> Label<'a> {} 1173impl<'a> Label<'a> {}
758 1174
759// LambdaExpr 1175// LambdaExpr
1176
1177#[derive(Debug, Clone)]
1178pub struct LambdaExprNode(SyntaxNode);
1179
1180impl 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)]
761pub struct LambdaExpr<'a> { 1190pub 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)]
1217pub struct LetStmtNode(SyntaxNode);
1218
1219impl 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)]
787pub struct LetStmt<'a> { 1229pub 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)]
1256pub struct LifetimeNode(SyntaxNode);
1257
1258impl 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)]
813pub struct Lifetime<'a> { 1268pub struct Lifetime<'a> {
814 syntax: SyntaxNodeRef<'a>, 1269 syntax: SyntaxNodeRef<'a>,
@@ -827,6 +1282,19 @@ impl<'a> AstNode<'a> for Lifetime<'a> {
827impl<'a> Lifetime<'a> {} 1282impl<'a> Lifetime<'a> {}
828 1283
829// LifetimeParam 1284// LifetimeParam
1285
1286#[derive(Debug, Clone)]
1287pub struct LifetimeParamNode(SyntaxNode);
1288
1289impl 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)]
831pub struct LifetimeParam<'a> { 1299pub 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)]
1322pub struct LiteralNode(SyntaxNode);
1323
1324impl 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)]
853pub struct Literal<'a> { 1334pub struct Literal<'a> {
854 syntax: SyntaxNodeRef<'a>, 1335 syntax: SyntaxNodeRef<'a>,
@@ -867,6 +1348,19 @@ impl<'a> AstNode<'a> for Literal<'a> {
867impl<'a> Literal<'a> {} 1348impl<'a> Literal<'a> {}
868 1349
869// LoopExpr 1350// LoopExpr
1351
1352#[derive(Debug, Clone)]
1353pub struct LoopExprNode(SyntaxNode);
1354
1355impl 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)]
871pub struct LoopExpr<'a> { 1365pub struct LoopExpr<'a> {
872 syntax: SyntaxNodeRef<'a>, 1366 syntax: SyntaxNodeRef<'a>,
@@ -886,6 +1380,19 @@ impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {}
886impl<'a> LoopExpr<'a> {} 1380impl<'a> LoopExpr<'a> {}
887 1381
888// MatchArm 1382// MatchArm
1383
1384#[derive(Debug, Clone)]
1385pub struct MatchArmNode(SyntaxNode);
1386
1387impl 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)]
890pub struct MatchArm<'a> { 1397pub 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)]
1428pub struct MatchArmListNode(SyntaxNode);
1429
1430impl 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)]
920pub struct MatchArmList<'a> { 1440pub 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)]
1463pub struct MatchExprNode(SyntaxNode);
1464
1465impl 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)]
942pub struct MatchExpr<'a> { 1475pub 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)]
1502pub struct MatchGuardNode(SyntaxNode);
1503
1504impl 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)]
968pub struct MatchGuard<'a> { 1514pub struct MatchGuard<'a> {
969 syntax: SyntaxNodeRef<'a>, 1515 syntax: SyntaxNodeRef<'a>,
@@ -982,6 +1528,19 @@ impl<'a> AstNode<'a> for MatchGuard<'a> {
982impl<'a> MatchGuard<'a> {} 1528impl<'a> MatchGuard<'a> {}
983 1529
984// MethodCallExpr 1530// MethodCallExpr
1531
1532#[derive(Debug, Clone)]
1533pub struct MethodCallExprNode(SyntaxNode);
1534
1535impl 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)]
986pub struct MethodCallExpr<'a> { 1545pub 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)]
1569pub struct ModuleNode(SyntaxNode);
1570
1571impl 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)]
1009pub struct Module<'a> { 1581pub 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)]
1606pub struct ModuleItemNode(SyntaxNode);
1607
1608impl 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)]
1033pub enum ModuleItem<'a> { 1618pub enum ModuleItem<'a> {
1034 StructDef(StructDef<'a>), 1619 StructDef(StructDef<'a>),
@@ -1081,6 +1666,19 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
1081impl<'a> ModuleItem<'a> {} 1666impl<'a> ModuleItem<'a> {}
1082 1667
1083// Name 1668// Name
1669
1670#[derive(Debug, Clone)]
1671pub struct NameNode(SyntaxNode);
1672
1673impl 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)]
1085pub struct Name<'a> { 1683pub struct Name<'a> {
1086 syntax: SyntaxNodeRef<'a>, 1684 syntax: SyntaxNodeRef<'a>,
@@ -1099,6 +1697,19 @@ impl<'a> AstNode<'a> for Name<'a> {
1099impl<'a> Name<'a> {} 1697impl<'a> Name<'a> {}
1100 1698
1101// NameRef 1699// NameRef
1700
1701#[derive(Debug, Clone)]
1702pub struct NameRefNode(SyntaxNode);
1703
1704impl 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)]
1103pub struct NameRef<'a> { 1714pub struct NameRef<'a> {
1104 syntax: SyntaxNodeRef<'a>, 1715 syntax: SyntaxNodeRef<'a>,
@@ -1117,6 +1728,19 @@ impl<'a> AstNode<'a> for NameRef<'a> {
1117impl<'a> NameRef<'a> {} 1728impl<'a> NameRef<'a> {}
1118 1729
1119// NamedField 1730// NamedField
1731
1732#[derive(Debug, Clone)]
1733pub struct NamedFieldNode(SyntaxNode);
1734
1735impl 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)]
1121pub struct NamedField<'a> { 1745pub struct NamedField<'a> {
1122 syntax: SyntaxNodeRef<'a>, 1746 syntax: SyntaxNodeRef<'a>,
@@ -1135,6 +1759,19 @@ impl<'a> AstNode<'a> for NamedField<'a> {
1135impl<'a> NamedField<'a> {} 1759impl<'a> NamedField<'a> {}
1136 1760
1137// NamedFieldDef 1761// NamedFieldDef
1762
1763#[derive(Debug, Clone)]
1764pub struct NamedFieldDefNode(SyntaxNode);
1765
1766impl 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)]
1139pub struct NamedFieldDef<'a> { 1776pub struct NamedFieldDef<'a> {
1140 syntax: SyntaxNodeRef<'a>, 1777 syntax: SyntaxNodeRef<'a>,
@@ -1155,6 +1792,19 @@ impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {}
1155impl<'a> NamedFieldDef<'a> {} 1792impl<'a> NamedFieldDef<'a> {}
1156 1793
1157// NamedFieldList 1794// NamedFieldList
1795
1796#[derive(Debug, Clone)]
1797pub struct NamedFieldListNode(SyntaxNode);
1798
1799impl 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)]
1159pub struct NamedFieldList<'a> { 1809pub struct NamedFieldList<'a> {
1160 syntax: SyntaxNodeRef<'a>, 1810 syntax: SyntaxNodeRef<'a>,
@@ -1173,6 +1823,19 @@ impl<'a> AstNode<'a> for NamedFieldList<'a> {
1173impl<'a> NamedFieldList<'a> {} 1823impl<'a> NamedFieldList<'a> {}
1174 1824
1175// NeverType 1825// NeverType
1826
1827#[derive(Debug, Clone)]
1828pub struct NeverTypeNode(SyntaxNode);
1829
1830impl 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)]
1177pub struct NeverType<'a> { 1840pub struct NeverType<'a> {
1178 syntax: SyntaxNodeRef<'a>, 1841 syntax: SyntaxNodeRef<'a>,
@@ -1191,6 +1854,19 @@ impl<'a> AstNode<'a> for NeverType<'a> {
1191impl<'a> NeverType<'a> {} 1854impl<'a> NeverType<'a> {}
1192 1855
1193// NominalDef 1856// NominalDef
1857
1858#[derive(Debug, Clone)]
1859pub struct NominalDefNode(SyntaxNode);
1860
1861impl 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)]
1195pub enum NominalDef<'a> { 1871pub enum NominalDef<'a> {
1196 StructDef(StructDef<'a>), 1872 StructDef(StructDef<'a>),
@@ -1219,6 +1895,19 @@ impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {}
1219impl<'a> NominalDef<'a> {} 1895impl<'a> NominalDef<'a> {}
1220 1896
1221// Param 1897// Param
1898
1899#[derive(Debug, Clone)]
1900pub struct ParamNode(SyntaxNode);
1901
1902impl 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)]
1223pub struct Param<'a> { 1912pub 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)]
1935pub struct ParamListNode(SyntaxNode);
1936
1937impl 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)]
1245pub struct ParamList<'a> { 1947pub 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)]
1974pub struct ParenExprNode(SyntaxNode);
1975
1976impl 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)]
1271pub struct ParenExpr<'a> { 1986pub struct ParenExpr<'a> {
1272 syntax: SyntaxNodeRef<'a>, 1987 syntax: SyntaxNodeRef<'a>,
@@ -1285,6 +2000,19 @@ impl<'a> AstNode<'a> for ParenExpr<'a> {
1285impl<'a> ParenExpr<'a> {} 2000impl<'a> ParenExpr<'a> {}
1286 2001
1287// ParenType 2002// ParenType
2003
2004#[derive(Debug, Clone)]
2005pub struct ParenTypeNode(SyntaxNode);
2006
2007impl 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)]
1289pub struct ParenType<'a> { 2017pub struct ParenType<'a> {
1290 syntax: SyntaxNodeRef<'a>, 2018 syntax: SyntaxNodeRef<'a>,
@@ -1303,6 +2031,19 @@ impl<'a> AstNode<'a> for ParenType<'a> {
1303impl<'a> ParenType<'a> {} 2031impl<'a> ParenType<'a> {}
1304 2032
1305// Pat 2033// Pat
2034
2035#[derive(Debug, Clone)]
2036pub struct PatNode(SyntaxNode);
2037
2038impl 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)]
1307pub enum Pat<'a> { 2048pub enum Pat<'a> {
1308 RefPat(RefPat<'a>), 2049 RefPat(RefPat<'a>),
@@ -1352,6 +2093,19 @@ impl<'a> AstNode<'a> for Pat<'a> {
1352impl<'a> Pat<'a> {} 2093impl<'a> Pat<'a> {}
1353 2094
1354// Path 2095// Path
2096
2097#[derive(Debug, Clone)]
2098pub struct PathNode(SyntaxNode);
2099
2100impl 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)]
1356pub struct Path<'a> { 2110pub 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)]
2137pub struct PathExprNode(SyntaxNode);
2138
2139impl 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)]
1382pub struct PathExpr<'a> { 2149pub 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)]
2172pub struct PathPatNode(SyntaxNode);
2173
2174impl 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)]
1404pub struct PathPat<'a> { 2184pub struct PathPat<'a> {
1405 syntax: SyntaxNodeRef<'a>, 2185 syntax: SyntaxNodeRef<'a>,
@@ -1418,6 +2198,19 @@ impl<'a> AstNode<'a> for PathPat<'a> {
1418impl<'a> PathPat<'a> {} 2198impl<'a> PathPat<'a> {}
1419 2199
1420// PathSegment 2200// PathSegment
2201
2202#[derive(Debug, Clone)]
2203pub struct PathSegmentNode(SyntaxNode);
2204
2205impl 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)]
1422pub struct PathSegment<'a> { 2215pub 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)]
2238pub struct PathTypeNode(SyntaxNode);
2239
2240impl 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)]
1444pub struct PathType<'a> { 2250pub struct PathType<'a> {
1445 syntax: SyntaxNodeRef<'a>, 2251 syntax: SyntaxNodeRef<'a>,
@@ -1458,6 +2264,19 @@ impl<'a> AstNode<'a> for PathType<'a> {
1458impl<'a> PathType<'a> {} 2264impl<'a> PathType<'a> {}
1459 2265
1460// PlaceholderPat 2266// PlaceholderPat
2267
2268#[derive(Debug, Clone)]
2269pub struct PlaceholderPatNode(SyntaxNode);
2270
2271impl 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)]
1462pub struct PlaceholderPat<'a> { 2281pub struct PlaceholderPat<'a> {
1463 syntax: SyntaxNodeRef<'a>, 2282 syntax: SyntaxNodeRef<'a>,
@@ -1476,6 +2295,19 @@ impl<'a> AstNode<'a> for PlaceholderPat<'a> {
1476impl<'a> PlaceholderPat<'a> {} 2295impl<'a> PlaceholderPat<'a> {}
1477 2296
1478// PlaceholderType 2297// PlaceholderType
2298
2299#[derive(Debug, Clone)]
2300pub struct PlaceholderTypeNode(SyntaxNode);
2301
2302impl 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)]
1480pub struct PlaceholderType<'a> { 2312pub struct PlaceholderType<'a> {
1481 syntax: SyntaxNodeRef<'a>, 2313 syntax: SyntaxNodeRef<'a>,
@@ -1494,6 +2326,19 @@ impl<'a> AstNode<'a> for PlaceholderType<'a> {
1494impl<'a> PlaceholderType<'a> {} 2326impl<'a> PlaceholderType<'a> {}
1495 2327
1496// PointerType 2328// PointerType
2329
2330#[derive(Debug, Clone)]
2331pub struct PointerTypeNode(SyntaxNode);
2332
2333impl 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)]
1498pub struct PointerType<'a> { 2343pub struct PointerType<'a> {
1499 syntax: SyntaxNodeRef<'a>, 2344 syntax: SyntaxNodeRef<'a>,
@@ -1512,6 +2357,19 @@ impl<'a> AstNode<'a> for PointerType<'a> {
1512impl<'a> PointerType<'a> {} 2357impl<'a> PointerType<'a> {}
1513 2358
1514// PrefixExpr 2359// PrefixExpr
2360
2361#[derive(Debug, Clone)]
2362pub struct PrefixExprNode(SyntaxNode);
2363
2364impl 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)]
1516pub struct PrefixExpr<'a> { 2374pub struct PrefixExpr<'a> {
1517 syntax: SyntaxNodeRef<'a>, 2375 syntax: SyntaxNodeRef<'a>,
@@ -1530,6 +2388,19 @@ impl<'a> AstNode<'a> for PrefixExpr<'a> {
1530impl<'a> PrefixExpr<'a> {} 2388impl<'a> PrefixExpr<'a> {}
1531 2389
1532// RangeExpr 2390// RangeExpr
2391
2392#[derive(Debug, Clone)]
2393pub struct RangeExprNode(SyntaxNode);
2394
2395impl 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)]
1534pub struct RangeExpr<'a> { 2405pub struct RangeExpr<'a> {
1535 syntax: SyntaxNodeRef<'a>, 2406 syntax: SyntaxNodeRef<'a>,
@@ -1548,6 +2419,19 @@ impl<'a> AstNode<'a> for RangeExpr<'a> {
1548impl<'a> RangeExpr<'a> {} 2419impl<'a> RangeExpr<'a> {}
1549 2420
1550// RangePat 2421// RangePat
2422
2423#[derive(Debug, Clone)]
2424pub struct RangePatNode(SyntaxNode);
2425
2426impl 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)]
1552pub struct RangePat<'a> { 2436pub struct RangePat<'a> {
1553 syntax: SyntaxNodeRef<'a>, 2437 syntax: SyntaxNodeRef<'a>,
@@ -1566,6 +2450,19 @@ impl<'a> AstNode<'a> for RangePat<'a> {
1566impl<'a> RangePat<'a> {} 2450impl<'a> RangePat<'a> {}
1567 2451
1568// RefExpr 2452// RefExpr
2453
2454#[derive(Debug, Clone)]
2455pub struct RefExprNode(SyntaxNode);
2456
2457impl 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)]
1570pub struct RefExpr<'a> { 2467pub struct RefExpr<'a> {
1571 syntax: SyntaxNodeRef<'a>, 2468 syntax: SyntaxNodeRef<'a>,
@@ -1584,6 +2481,19 @@ impl<'a> AstNode<'a> for RefExpr<'a> {
1584impl<'a> RefExpr<'a> {} 2481impl<'a> RefExpr<'a> {}
1585 2482
1586// RefPat 2483// RefPat
2484
2485#[derive(Debug, Clone)]
2486pub struct RefPatNode(SyntaxNode);
2487
2488impl 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)]
1588pub struct RefPat<'a> { 2498pub struct RefPat<'a> {
1589 syntax: SyntaxNodeRef<'a>, 2499 syntax: SyntaxNodeRef<'a>,
@@ -1602,6 +2512,19 @@ impl<'a> AstNode<'a> for RefPat<'a> {
1602impl<'a> RefPat<'a> {} 2512impl<'a> RefPat<'a> {}
1603 2513
1604// ReferenceType 2514// ReferenceType
2515
2516#[derive(Debug, Clone)]
2517pub struct ReferenceTypeNode(SyntaxNode);
2518
2519impl 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)]
1606pub struct ReferenceType<'a> { 2529pub struct ReferenceType<'a> {
1607 syntax: SyntaxNodeRef<'a>, 2530 syntax: SyntaxNodeRef<'a>,
@@ -1620,6 +2543,19 @@ impl<'a> AstNode<'a> for ReferenceType<'a> {
1620impl<'a> ReferenceType<'a> {} 2543impl<'a> ReferenceType<'a> {}
1621 2544
1622// RetType 2545// RetType
2546
2547#[derive(Debug, Clone)]
2548pub struct RetTypeNode(SyntaxNode);
2549
2550impl 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)]
1624pub struct RetType<'a> { 2560pub struct RetType<'a> {
1625 syntax: SyntaxNodeRef<'a>, 2561 syntax: SyntaxNodeRef<'a>,
@@ -1638,6 +2574,19 @@ impl<'a> AstNode<'a> for RetType<'a> {
1638impl<'a> RetType<'a> {} 2574impl<'a> RetType<'a> {}
1639 2575
1640// ReturnExpr 2576// ReturnExpr
2577
2578#[derive(Debug, Clone)]
2579pub struct ReturnExprNode(SyntaxNode);
2580
2581impl 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)]
1642pub struct ReturnExpr<'a> { 2591pub struct ReturnExpr<'a> {
1643 syntax: SyntaxNodeRef<'a>, 2592 syntax: SyntaxNodeRef<'a>,
@@ -1656,6 +2605,19 @@ impl<'a> AstNode<'a> for ReturnExpr<'a> {
1656impl<'a> ReturnExpr<'a> {} 2605impl<'a> ReturnExpr<'a> {}
1657 2606
1658// Root 2607// Root
2608
2609#[derive(Debug, Clone)]
2610pub struct RootNode(SyntaxNode);
2611
2612impl 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)]
1660pub struct Root<'a> { 2622pub 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)]
2647pub struct SelfParamNode(SyntaxNode);
2648
2649impl 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)]
1684pub struct SelfParam<'a> { 2659pub struct SelfParam<'a> {
1685 syntax: SyntaxNodeRef<'a>, 2660 syntax: SyntaxNodeRef<'a>,
@@ -1698,6 +2673,19 @@ impl<'a> AstNode<'a> for SelfParam<'a> {
1698impl<'a> SelfParam<'a> {} 2673impl<'a> SelfParam<'a> {}
1699 2674
1700// SlicePat 2675// SlicePat
2676
2677#[derive(Debug, Clone)]
2678pub struct SlicePatNode(SyntaxNode);
2679
2680impl 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)]
1702pub struct SlicePat<'a> { 2690pub struct SlicePat<'a> {
1703 syntax: SyntaxNodeRef<'a>, 2691 syntax: SyntaxNodeRef<'a>,
@@ -1716,6 +2704,19 @@ impl<'a> AstNode<'a> for SlicePat<'a> {
1716impl<'a> SlicePat<'a> {} 2704impl<'a> SlicePat<'a> {}
1717 2705
1718// SliceType 2706// SliceType
2707
2708#[derive(Debug, Clone)]
2709pub struct SliceTypeNode(SyntaxNode);
2710
2711impl 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)]
1720pub struct SliceType<'a> { 2721pub struct SliceType<'a> {
1721 syntax: SyntaxNodeRef<'a>, 2722 syntax: SyntaxNodeRef<'a>,
@@ -1734,6 +2735,19 @@ impl<'a> AstNode<'a> for SliceType<'a> {
1734impl<'a> SliceType<'a> {} 2735impl<'a> SliceType<'a> {}
1735 2736
1736// StaticDef 2737// StaticDef
2738
2739#[derive(Debug, Clone)]
2740pub struct StaticDefNode(SyntaxNode);
2741
2742impl 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)]
1738pub struct StaticDef<'a> { 2752pub struct StaticDef<'a> {
1739 syntax: SyntaxNodeRef<'a>, 2753 syntax: SyntaxNodeRef<'a>,
@@ -1755,6 +2769,19 @@ impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {}
1755impl<'a> StaticDef<'a> {} 2769impl<'a> StaticDef<'a> {}
1756 2770
1757// Stmt 2771// Stmt
2772
2773#[derive(Debug, Clone)]
2774pub struct StmtNode(SyntaxNode);
2775
2776impl 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)]
1759pub enum Stmt<'a> { 2786pub enum Stmt<'a> {
1760 ExprStmt(ExprStmt<'a>), 2787 ExprStmt(ExprStmt<'a>),
@@ -1780,6 +2807,19 @@ impl<'a> AstNode<'a> for Stmt<'a> {
1780impl<'a> Stmt<'a> {} 2807impl<'a> Stmt<'a> {}
1781 2808
1782// StructDef 2809// StructDef
2810
2811#[derive(Debug, Clone)]
2812pub struct StructDefNode(SyntaxNode);
2813
2814impl 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)]
1784pub struct StructDef<'a> { 2824pub 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)]
2850pub struct StructLitNode(SyntaxNode);
2851
2852impl 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)]
1809pub struct StructLit<'a> { 2862pub struct StructLit<'a> {
1810 syntax: SyntaxNodeRef<'a>, 2863 syntax: SyntaxNodeRef<'a>,
@@ -1823,6 +2876,19 @@ impl<'a> AstNode<'a> for StructLit<'a> {
1823impl<'a> StructLit<'a> {} 2876impl<'a> StructLit<'a> {}
1824 2877
1825// StructPat 2878// StructPat
2879
2880#[derive(Debug, Clone)]
2881pub struct StructPatNode(SyntaxNode);
2882
2883impl 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)]
1827pub struct StructPat<'a> { 2893pub struct StructPat<'a> {
1828 syntax: SyntaxNodeRef<'a>, 2894 syntax: SyntaxNodeRef<'a>,
@@ -1841,6 +2907,19 @@ impl<'a> AstNode<'a> for StructPat<'a> {
1841impl<'a> StructPat<'a> {} 2907impl<'a> StructPat<'a> {}
1842 2908
1843// TokenTree 2909// TokenTree
2910
2911#[derive(Debug, Clone)]
2912pub struct TokenTreeNode(SyntaxNode);
2913
2914impl 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)]
1845pub struct TokenTree<'a> { 2924pub struct TokenTree<'a> {
1846 syntax: SyntaxNodeRef<'a>, 2925 syntax: SyntaxNodeRef<'a>,
@@ -1859,6 +2938,19 @@ impl<'a> AstNode<'a> for TokenTree<'a> {
1859impl<'a> TokenTree<'a> {} 2938impl<'a> TokenTree<'a> {}
1860 2939
1861// TraitDef 2940// TraitDef
2941
2942#[derive(Debug, Clone)]
2943pub struct TraitDefNode(SyntaxNode);
2944
2945impl 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)]
1863pub struct TraitDef<'a> { 2955pub struct TraitDef<'a> {
1864 syntax: SyntaxNodeRef<'a>, 2956 syntax: SyntaxNodeRef<'a>,
@@ -1879,6 +2971,19 @@ impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {}
1879impl<'a> TraitDef<'a> {} 2971impl<'a> TraitDef<'a> {}
1880 2972
1881// TryExpr 2973// TryExpr
2974
2975#[derive(Debug, Clone)]
2976pub struct TryExprNode(SyntaxNode);
2977
2978impl 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)]
1883pub struct TryExpr<'a> { 2988pub struct TryExpr<'a> {
1884 syntax: SyntaxNodeRef<'a>, 2989 syntax: SyntaxNodeRef<'a>,
@@ -1897,6 +3002,19 @@ impl<'a> AstNode<'a> for TryExpr<'a> {
1897impl<'a> TryExpr<'a> {} 3002impl<'a> TryExpr<'a> {}
1898 3003
1899// TupleExpr 3004// TupleExpr
3005
3006#[derive(Debug, Clone)]
3007pub struct TupleExprNode(SyntaxNode);
3008
3009impl 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)]
1901pub struct TupleExpr<'a> { 3019pub struct TupleExpr<'a> {
1902 syntax: SyntaxNodeRef<'a>, 3020 syntax: SyntaxNodeRef<'a>,
@@ -1915,6 +3033,19 @@ impl<'a> AstNode<'a> for TupleExpr<'a> {
1915impl<'a> TupleExpr<'a> {} 3033impl<'a> TupleExpr<'a> {}
1916 3034
1917// TuplePat 3035// TuplePat
3036
3037#[derive(Debug, Clone)]
3038pub struct TuplePatNode(SyntaxNode);
3039
3040impl 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)]
1919pub struct TuplePat<'a> { 3050pub struct TuplePat<'a> {
1920 syntax: SyntaxNodeRef<'a>, 3051 syntax: SyntaxNodeRef<'a>,
@@ -1933,6 +3064,19 @@ impl<'a> AstNode<'a> for TuplePat<'a> {
1933impl<'a> TuplePat<'a> {} 3064impl<'a> TuplePat<'a> {}
1934 3065
1935// TupleStructPat 3066// TupleStructPat
3067
3068#[derive(Debug, Clone)]
3069pub struct TupleStructPatNode(SyntaxNode);
3070
3071impl 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)]
1937pub struct TupleStructPat<'a> { 3081pub struct TupleStructPat<'a> {
1938 syntax: SyntaxNodeRef<'a>, 3082 syntax: SyntaxNodeRef<'a>,
@@ -1951,6 +3095,19 @@ impl<'a> AstNode<'a> for TupleStructPat<'a> {
1951impl<'a> TupleStructPat<'a> {} 3095impl<'a> TupleStructPat<'a> {}
1952 3096
1953// TupleType 3097// TupleType
3098
3099#[derive(Debug, Clone)]
3100pub struct TupleTypeNode(SyntaxNode);
3101
3102impl 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)]
1955pub struct TupleType<'a> { 3112pub struct TupleType<'a> {
1956 syntax: SyntaxNodeRef<'a>, 3113 syntax: SyntaxNodeRef<'a>,
@@ -1969,6 +3126,19 @@ impl<'a> AstNode<'a> for TupleType<'a> {
1969impl<'a> TupleType<'a> {} 3126impl<'a> TupleType<'a> {}
1970 3127
1971// TypeDef 3128// TypeDef
3129
3130#[derive(Debug, Clone)]
3131pub struct TypeDefNode(SyntaxNode);
3132
3133impl 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)]
1973pub struct TypeDef<'a> { 3143pub struct TypeDef<'a> {
1974 syntax: SyntaxNodeRef<'a>, 3144 syntax: SyntaxNodeRef<'a>,
@@ -1990,6 +3160,19 @@ impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {}
1990impl<'a> TypeDef<'a> {} 3160impl<'a> TypeDef<'a> {}
1991 3161
1992// TypeParam 3162// TypeParam
3163
3164#[derive(Debug, Clone)]
3165pub struct TypeParamNode(SyntaxNode);
3166
3167impl 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)]
1994pub struct TypeParam<'a> { 3177pub struct TypeParam<'a> {
1995 syntax: SyntaxNodeRef<'a>, 3178 syntax: SyntaxNodeRef<'a>,
@@ -2009,6 +3192,19 @@ impl<'a> ast::NameOwner<'a> for TypeParam<'a> {}
2009impl<'a> TypeParam<'a> {} 3192impl<'a> TypeParam<'a> {}
2010 3193
2011// TypeParamList 3194// TypeParamList
3195
3196#[derive(Debug, Clone)]
3197pub struct TypeParamListNode(SyntaxNode);
3198
3199impl 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)]
2013pub struct TypeParamList<'a> { 3209pub 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)]
3236pub struct TypeRefNode(SyntaxNode);
3237
3238impl 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)]
2039pub enum TypeRef<'a> { 3248pub enum TypeRef<'a> {
2040 ParenType(ParenType<'a>), 3249 ParenType(ParenType<'a>),
@@ -2093,6 +3302,19 @@ impl<'a> AstNode<'a> for TypeRef<'a> {
2093impl<'a> TypeRef<'a> {} 3302impl<'a> TypeRef<'a> {}
2094 3303
2095// UseItem 3304// UseItem
3305
3306#[derive(Debug, Clone)]
3307pub struct UseItemNode(SyntaxNode);
3308
3309impl 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)]
2097pub struct UseItem<'a> { 3319pub 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)]
3342pub struct UseTreeNode(SyntaxNode);
3343
3344impl 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)]
2119pub struct UseTree<'a> { 3354pub 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)]
3381pub struct UseTreeListNode(SyntaxNode);
3382
3383impl 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)]
2145pub struct UseTreeList<'a> { 3393pub 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)]
3416pub struct WhereClauseNode(SyntaxNode);
3417
3418impl 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)]
2167pub struct WhereClause<'a> { 3428pub struct WhereClause<'a> {
2168 syntax: SyntaxNodeRef<'a>, 3429 syntax: SyntaxNodeRef<'a>,
@@ -2181,6 +3442,19 @@ impl<'a> AstNode<'a> for WhereClause<'a> {
2181impl<'a> WhereClause<'a> {} 3442impl<'a> WhereClause<'a> {}
2182 3443
2183// WhileExpr 3444// WhileExpr
3445
3446#[derive(Debug, Clone)]
3447pub struct WhileExprNode(SyntaxNode);
3448
3449impl 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)]
2185pub struct WhileExpr<'a> { 3459pub 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)]
3483pub struct WhitespaceNode(SyntaxNode);
3484
3485impl 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)]
2208pub struct Whitespace<'a> { 3495pub 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
8use crate::{ 8use 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)]
17pub struct {{ node }}Node(SyntaxNode);
18
19impl {{ 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)]
17pub enum {{ node }}<'a> { 31pub enum {{ node }}<'a> {