diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 12 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 497 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs.tera | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar.ron | 4 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions/atom.rs | 36 | ||||
-rw-r--r-- | crates/ra_syntax/src/yellow.rs | 22 |
7 files changed, 551 insertions, 30 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index bcbd4c60c..165b308d1 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -15,12 +15,13 @@ use crate::{ | |||
15 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly | 15 | /// conversion itself has zero runtime cost: ast and syntax nodes have exactly |
16 | /// the same representation: a pointer to the tree root and a pointer to the | 16 | /// the same representation: a pointer to the tree root and a pointer to the |
17 | /// node itself. | 17 | /// node itself. |
18 | pub trait AstNode: rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> { | 18 | pub trait AstNode: |
19 | rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>> | ||
20 | { | ||
19 | fn cast(syntax: &SyntaxNode) -> Option<&Self> | 21 | fn cast(syntax: &SyntaxNode) -> Option<&Self> |
20 | where | 22 | where |
21 | Self: Sized; | 23 | Self: Sized; |
22 | fn syntax(&self) -> &SyntaxNode; | 24 | fn syntax(&self) -> &SyntaxNode; |
23 | fn to_owned(&self) -> TreeArc<Self>; | ||
24 | } | 25 | } |
25 | 26 | ||
26 | pub trait AstToken: AstNode { | 27 | pub trait AstToken: AstNode { |
@@ -430,6 +431,13 @@ impl StructDef { | |||
430 | } | 431 | } |
431 | 432 | ||
432 | impl EnumVariant { | 433 | impl EnumVariant { |
434 | pub fn parent_enum(&self) -> &EnumDef { | ||
435 | self.syntax() | ||
436 | .parent() | ||
437 | .and_then(|it| it.parent()) | ||
438 | .and_then(EnumDef::cast) | ||
439 | .expect("EnumVariants are always nested in Enums") | ||
440 | } | ||
433 | pub fn flavor(&self) -> StructFlavor { | 441 | pub fn flavor(&self) -> StructFlavor { |
434 | StructFlavor::from_node(self) | 442 | StructFlavor::from_node(self) |
435 | } | 443 | } |
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index be16511df..7da19d782 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -35,6 +35,10 @@ impl AstNode for ArgList { | |||
35 | } | 35 | } |
36 | } | 36 | } |
37 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 37 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
38 | } | ||
39 | |||
40 | impl ToOwned for ArgList { | ||
41 | type Owned = TreeArc<ArgList>; | ||
38 | fn to_owned(&self) -> TreeArc<ArgList> { TreeArc::cast(self.syntax.to_owned()) } | 42 | fn to_owned(&self) -> TreeArc<ArgList> { TreeArc::cast(self.syntax.to_owned()) } |
39 | } | 43 | } |
40 | 44 | ||
@@ -63,6 +67,10 @@ impl AstNode for ArrayExpr { | |||
63 | } | 67 | } |
64 | } | 68 | } |
65 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 69 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
70 | } | ||
71 | |||
72 | impl ToOwned for ArrayExpr { | ||
73 | type Owned = TreeArc<ArrayExpr>; | ||
66 | fn to_owned(&self) -> TreeArc<ArrayExpr> { TreeArc::cast(self.syntax.to_owned()) } | 74 | fn to_owned(&self) -> TreeArc<ArrayExpr> { TreeArc::cast(self.syntax.to_owned()) } |
67 | } | 75 | } |
68 | 76 | ||
@@ -91,6 +99,10 @@ impl AstNode for ArrayType { | |||
91 | } | 99 | } |
92 | } | 100 | } |
93 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 101 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
102 | } | ||
103 | |||
104 | impl ToOwned for ArrayType { | ||
105 | type Owned = TreeArc<ArrayType>; | ||
94 | fn to_owned(&self) -> TreeArc<ArrayType> { TreeArc::cast(self.syntax.to_owned()) } | 106 | fn to_owned(&self) -> TreeArc<ArrayType> { TreeArc::cast(self.syntax.to_owned()) } |
95 | } | 107 | } |
96 | 108 | ||
@@ -123,6 +135,10 @@ impl AstNode for AssocTypeArg { | |||
123 | } | 135 | } |
124 | } | 136 | } |
125 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 137 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
138 | } | ||
139 | |||
140 | impl ToOwned for AssocTypeArg { | ||
141 | type Owned = TreeArc<AssocTypeArg>; | ||
126 | fn to_owned(&self) -> TreeArc<AssocTypeArg> { TreeArc::cast(self.syntax.to_owned()) } | 142 | fn to_owned(&self) -> TreeArc<AssocTypeArg> { TreeArc::cast(self.syntax.to_owned()) } |
127 | } | 143 | } |
128 | 144 | ||
@@ -155,6 +171,10 @@ impl AstNode for Attr { | |||
155 | } | 171 | } |
156 | } | 172 | } |
157 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 173 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
174 | } | ||
175 | |||
176 | impl ToOwned for Attr { | ||
177 | type Owned = TreeArc<Attr>; | ||
158 | fn to_owned(&self) -> TreeArc<Attr> { TreeArc::cast(self.syntax.to_owned()) } | 178 | fn to_owned(&self) -> TreeArc<Attr> { TreeArc::cast(self.syntax.to_owned()) } |
159 | } | 179 | } |
160 | 180 | ||
@@ -183,6 +203,10 @@ impl AstNode for BinExpr { | |||
183 | } | 203 | } |
184 | } | 204 | } |
185 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 205 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
206 | } | ||
207 | |||
208 | impl ToOwned for BinExpr { | ||
209 | type Owned = TreeArc<BinExpr>; | ||
186 | fn to_owned(&self) -> TreeArc<BinExpr> { TreeArc::cast(self.syntax.to_owned()) } | 210 | fn to_owned(&self) -> TreeArc<BinExpr> { TreeArc::cast(self.syntax.to_owned()) } |
187 | } | 211 | } |
188 | 212 | ||
@@ -207,6 +231,10 @@ impl AstNode for BindPat { | |||
207 | } | 231 | } |
208 | } | 232 | } |
209 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 233 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
234 | } | ||
235 | |||
236 | impl ToOwned for BindPat { | ||
237 | type Owned = TreeArc<BindPat>; | ||
210 | fn to_owned(&self) -> TreeArc<BindPat> { TreeArc::cast(self.syntax.to_owned()) } | 238 | fn to_owned(&self) -> TreeArc<BindPat> { TreeArc::cast(self.syntax.to_owned()) } |
211 | } | 239 | } |
212 | 240 | ||
@@ -236,6 +264,10 @@ impl AstNode for Block { | |||
236 | } | 264 | } |
237 | } | 265 | } |
238 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 266 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
267 | } | ||
268 | |||
269 | impl ToOwned for Block { | ||
270 | type Owned = TreeArc<Block>; | ||
239 | fn to_owned(&self) -> TreeArc<Block> { TreeArc::cast(self.syntax.to_owned()) } | 271 | fn to_owned(&self) -> TreeArc<Block> { TreeArc::cast(self.syntax.to_owned()) } |
240 | } | 272 | } |
241 | 273 | ||
@@ -268,6 +300,10 @@ impl AstNode for BlockExpr { | |||
268 | } | 300 | } |
269 | } | 301 | } |
270 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 302 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
303 | } | ||
304 | |||
305 | impl ToOwned for BlockExpr { | ||
306 | type Owned = TreeArc<BlockExpr>; | ||
271 | fn to_owned(&self) -> TreeArc<BlockExpr> { TreeArc::cast(self.syntax.to_owned()) } | 307 | fn to_owned(&self) -> TreeArc<BlockExpr> { TreeArc::cast(self.syntax.to_owned()) } |
272 | } | 308 | } |
273 | 309 | ||
@@ -296,6 +332,10 @@ impl AstNode for BreakExpr { | |||
296 | } | 332 | } |
297 | } | 333 | } |
298 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 334 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
335 | } | ||
336 | |||
337 | impl ToOwned for BreakExpr { | ||
338 | type Owned = TreeArc<BreakExpr>; | ||
299 | fn to_owned(&self) -> TreeArc<BreakExpr> { TreeArc::cast(self.syntax.to_owned()) } | 339 | fn to_owned(&self) -> TreeArc<BreakExpr> { TreeArc::cast(self.syntax.to_owned()) } |
300 | } | 340 | } |
301 | 341 | ||
@@ -324,6 +364,10 @@ impl AstNode for Byte { | |||
324 | } | 364 | } |
325 | } | 365 | } |
326 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 366 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
367 | } | ||
368 | |||
369 | impl ToOwned for Byte { | ||
370 | type Owned = TreeArc<Byte>; | ||
327 | fn to_owned(&self) -> TreeArc<Byte> { TreeArc::cast(self.syntax.to_owned()) } | 371 | fn to_owned(&self) -> TreeArc<Byte> { TreeArc::cast(self.syntax.to_owned()) } |
328 | } | 372 | } |
329 | 373 | ||
@@ -349,6 +393,10 @@ impl AstNode for ByteString { | |||
349 | } | 393 | } |
350 | } | 394 | } |
351 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 395 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
396 | } | ||
397 | |||
398 | impl ToOwned for ByteString { | ||
399 | type Owned = TreeArc<ByteString>; | ||
352 | fn to_owned(&self) -> TreeArc<ByteString> { TreeArc::cast(self.syntax.to_owned()) } | 400 | fn to_owned(&self) -> TreeArc<ByteString> { TreeArc::cast(self.syntax.to_owned()) } |
353 | } | 401 | } |
354 | 402 | ||
@@ -374,6 +422,10 @@ impl AstNode for CallExpr { | |||
374 | } | 422 | } |
375 | } | 423 | } |
376 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 424 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
425 | } | ||
426 | |||
427 | impl ToOwned for CallExpr { | ||
428 | type Owned = TreeArc<CallExpr>; | ||
377 | fn to_owned(&self) -> TreeArc<CallExpr> { TreeArc::cast(self.syntax.to_owned()) } | 429 | fn to_owned(&self) -> TreeArc<CallExpr> { TreeArc::cast(self.syntax.to_owned()) } |
378 | } | 430 | } |
379 | 431 | ||
@@ -403,6 +455,10 @@ impl AstNode for CastExpr { | |||
403 | } | 455 | } |
404 | } | 456 | } |
405 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 457 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
458 | } | ||
459 | |||
460 | impl ToOwned for CastExpr { | ||
461 | type Owned = TreeArc<CastExpr>; | ||
406 | fn to_owned(&self) -> TreeArc<CastExpr> { TreeArc::cast(self.syntax.to_owned()) } | 462 | fn to_owned(&self) -> TreeArc<CastExpr> { TreeArc::cast(self.syntax.to_owned()) } |
407 | } | 463 | } |
408 | 464 | ||
@@ -435,6 +491,10 @@ impl AstNode for Char { | |||
435 | } | 491 | } |
436 | } | 492 | } |
437 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 493 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
494 | } | ||
495 | |||
496 | impl ToOwned for Char { | ||
497 | type Owned = TreeArc<Char>; | ||
438 | fn to_owned(&self) -> TreeArc<Char> { TreeArc::cast(self.syntax.to_owned()) } | 498 | fn to_owned(&self) -> TreeArc<Char> { TreeArc::cast(self.syntax.to_owned()) } |
439 | } | 499 | } |
440 | 500 | ||
@@ -460,6 +520,10 @@ impl AstNode for Comment { | |||
460 | } | 520 | } |
461 | } | 521 | } |
462 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 522 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
523 | } | ||
524 | |||
525 | impl ToOwned for Comment { | ||
526 | type Owned = TreeArc<Comment>; | ||
463 | fn to_owned(&self) -> TreeArc<Comment> { TreeArc::cast(self.syntax.to_owned()) } | 527 | fn to_owned(&self) -> TreeArc<Comment> { TreeArc::cast(self.syntax.to_owned()) } |
464 | } | 528 | } |
465 | 529 | ||
@@ -485,6 +549,10 @@ impl AstNode for Condition { | |||
485 | } | 549 | } |
486 | } | 550 | } |
487 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
552 | } | ||
553 | |||
554 | impl ToOwned for Condition { | ||
555 | type Owned = TreeArc<Condition>; | ||
488 | fn to_owned(&self) -> TreeArc<Condition> { TreeArc::cast(self.syntax.to_owned()) } | 556 | fn to_owned(&self) -> TreeArc<Condition> { TreeArc::cast(self.syntax.to_owned()) } |
489 | } | 557 | } |
490 | 558 | ||
@@ -517,6 +585,10 @@ impl AstNode for ConstDef { | |||
517 | } | 585 | } |
518 | } | 586 | } |
519 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 587 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
588 | } | ||
589 | |||
590 | impl ToOwned for ConstDef { | ||
591 | type Owned = TreeArc<ConstDef>; | ||
520 | fn to_owned(&self) -> TreeArc<ConstDef> { TreeArc::cast(self.syntax.to_owned()) } | 592 | fn to_owned(&self) -> TreeArc<ConstDef> { TreeArc::cast(self.syntax.to_owned()) } |
521 | } | 593 | } |
522 | 594 | ||
@@ -550,6 +622,10 @@ impl AstNode for ContinueExpr { | |||
550 | } | 622 | } |
551 | } | 623 | } |
552 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 624 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
625 | } | ||
626 | |||
627 | impl ToOwned for ContinueExpr { | ||
628 | type Owned = TreeArc<ContinueExpr>; | ||
553 | fn to_owned(&self) -> TreeArc<ContinueExpr> { TreeArc::cast(self.syntax.to_owned()) } | 629 | fn to_owned(&self) -> TreeArc<ContinueExpr> { TreeArc::cast(self.syntax.to_owned()) } |
554 | } | 630 | } |
555 | 631 | ||
@@ -574,6 +650,10 @@ impl AstNode for DynTraitType { | |||
574 | } | 650 | } |
575 | } | 651 | } |
576 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 652 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
653 | } | ||
654 | |||
655 | impl ToOwned for DynTraitType { | ||
656 | type Owned = TreeArc<DynTraitType>; | ||
577 | fn to_owned(&self) -> TreeArc<DynTraitType> { TreeArc::cast(self.syntax.to_owned()) } | 657 | fn to_owned(&self) -> TreeArc<DynTraitType> { TreeArc::cast(self.syntax.to_owned()) } |
578 | } | 658 | } |
579 | 659 | ||
@@ -598,6 +678,10 @@ impl AstNode for EnumDef { | |||
598 | } | 678 | } |
599 | } | 679 | } |
600 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 680 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
681 | } | ||
682 | |||
683 | impl ToOwned for EnumDef { | ||
684 | type Owned = TreeArc<EnumDef>; | ||
601 | fn to_owned(&self) -> TreeArc<EnumDef> { TreeArc::cast(self.syntax.to_owned()) } | 685 | fn to_owned(&self) -> TreeArc<EnumDef> { TreeArc::cast(self.syntax.to_owned()) } |
602 | } | 686 | } |
603 | 687 | ||
@@ -631,6 +715,10 @@ impl AstNode for EnumVariant { | |||
631 | } | 715 | } |
632 | } | 716 | } |
633 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 717 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
718 | } | ||
719 | |||
720 | impl ToOwned for EnumVariant { | ||
721 | type Owned = TreeArc<EnumVariant>; | ||
634 | fn to_owned(&self) -> TreeArc<EnumVariant> { TreeArc::cast(self.syntax.to_owned()) } | 722 | fn to_owned(&self) -> TreeArc<EnumVariant> { TreeArc::cast(self.syntax.to_owned()) } |
635 | } | 723 | } |
636 | 724 | ||
@@ -661,6 +749,10 @@ impl AstNode for EnumVariantList { | |||
661 | } | 749 | } |
662 | } | 750 | } |
663 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 751 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
752 | } | ||
753 | |||
754 | impl ToOwned for EnumVariantList { | ||
755 | type Owned = TreeArc<EnumVariantList>; | ||
664 | fn to_owned(&self) -> TreeArc<EnumVariantList> { TreeArc::cast(self.syntax.to_owned()) } | 756 | fn to_owned(&self) -> TreeArc<EnumVariantList> { TreeArc::cast(self.syntax.to_owned()) } |
665 | } | 757 | } |
666 | 758 | ||
@@ -746,6 +838,10 @@ impl AstNode for Expr { | |||
746 | } | 838 | } |
747 | } | 839 | } |
748 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 840 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
841 | } | ||
842 | |||
843 | impl ToOwned for Expr { | ||
844 | type Owned = TreeArc<Expr>; | ||
749 | fn to_owned(&self) -> TreeArc<Expr> { TreeArc::cast(self.syntax.to_owned()) } | 845 | fn to_owned(&self) -> TreeArc<Expr> { TreeArc::cast(self.syntax.to_owned()) } |
750 | } | 846 | } |
751 | 847 | ||
@@ -804,6 +900,10 @@ impl AstNode for ExprStmt { | |||
804 | } | 900 | } |
805 | } | 901 | } |
806 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 902 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
903 | } | ||
904 | |||
905 | impl ToOwned for ExprStmt { | ||
906 | type Owned = TreeArc<ExprStmt>; | ||
807 | fn to_owned(&self) -> TreeArc<ExprStmt> { TreeArc::cast(self.syntax.to_owned()) } | 907 | fn to_owned(&self) -> TreeArc<ExprStmt> { TreeArc::cast(self.syntax.to_owned()) } |
808 | } | 908 | } |
809 | 909 | ||
@@ -832,6 +932,10 @@ impl AstNode for ExternCrateItem { | |||
832 | } | 932 | } |
833 | } | 933 | } |
834 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 934 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
935 | } | ||
936 | |||
937 | impl ToOwned for ExternCrateItem { | ||
938 | type Owned = TreeArc<ExternCrateItem>; | ||
835 | fn to_owned(&self) -> TreeArc<ExternCrateItem> { TreeArc::cast(self.syntax.to_owned()) } | 939 | fn to_owned(&self) -> TreeArc<ExternCrateItem> { TreeArc::cast(self.syntax.to_owned()) } |
836 | } | 940 | } |
837 | 941 | ||
@@ -856,6 +960,10 @@ impl AstNode for FalseKw { | |||
856 | } | 960 | } |
857 | } | 961 | } |
858 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 962 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
963 | } | ||
964 | |||
965 | impl ToOwned for FalseKw { | ||
966 | type Owned = TreeArc<FalseKw>; | ||
859 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } | 967 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } |
860 | } | 968 | } |
861 | 969 | ||
@@ -881,6 +989,10 @@ impl AstNode for FieldExpr { | |||
881 | } | 989 | } |
882 | } | 990 | } |
883 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 991 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
992 | } | ||
993 | |||
994 | impl ToOwned for FieldExpr { | ||
995 | type Owned = TreeArc<FieldExpr>; | ||
884 | fn to_owned(&self) -> TreeArc<FieldExpr> { TreeArc::cast(self.syntax.to_owned()) } | 996 | fn to_owned(&self) -> TreeArc<FieldExpr> { TreeArc::cast(self.syntax.to_owned()) } |
885 | } | 997 | } |
886 | 998 | ||
@@ -913,6 +1025,10 @@ impl AstNode for FieldPat { | |||
913 | } | 1025 | } |
914 | } | 1026 | } |
915 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1027 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1028 | } | ||
1029 | |||
1030 | impl ToOwned for FieldPat { | ||
1031 | type Owned = TreeArc<FieldPat>; | ||
916 | fn to_owned(&self) -> TreeArc<FieldPat> { TreeArc::cast(self.syntax.to_owned()) } | 1032 | fn to_owned(&self) -> TreeArc<FieldPat> { TreeArc::cast(self.syntax.to_owned()) } |
917 | } | 1033 | } |
918 | 1034 | ||
@@ -942,6 +1058,10 @@ impl AstNode for FieldPatList { | |||
942 | } | 1058 | } |
943 | } | 1059 | } |
944 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1060 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1061 | } | ||
1062 | |||
1063 | impl ToOwned for FieldPatList { | ||
1064 | type Owned = TreeArc<FieldPatList>; | ||
945 | fn to_owned(&self) -> TreeArc<FieldPatList> { TreeArc::cast(self.syntax.to_owned()) } | 1065 | fn to_owned(&self) -> TreeArc<FieldPatList> { TreeArc::cast(self.syntax.to_owned()) } |
946 | } | 1066 | } |
947 | 1067 | ||
@@ -974,6 +1094,10 @@ impl AstNode for FloatNumber { | |||
974 | } | 1094 | } |
975 | } | 1095 | } |
976 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1096 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1097 | } | ||
1098 | |||
1099 | impl ToOwned for FloatNumber { | ||
1100 | type Owned = TreeArc<FloatNumber>; | ||
977 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } | 1101 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } |
978 | } | 1102 | } |
979 | 1103 | ||
@@ -999,6 +1123,10 @@ impl AstNode for FnDef { | |||
999 | } | 1123 | } |
1000 | } | 1124 | } |
1001 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1125 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1126 | } | ||
1127 | |||
1128 | impl ToOwned for FnDef { | ||
1129 | type Owned = TreeArc<FnDef>; | ||
1002 | fn to_owned(&self) -> TreeArc<FnDef> { TreeArc::cast(self.syntax.to_owned()) } | 1130 | fn to_owned(&self) -> TreeArc<FnDef> { TreeArc::cast(self.syntax.to_owned()) } |
1003 | } | 1131 | } |
1004 | 1132 | ||
@@ -1040,6 +1168,10 @@ impl AstNode for FnPointerType { | |||
1040 | } | 1168 | } |
1041 | } | 1169 | } |
1042 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1170 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1171 | } | ||
1172 | |||
1173 | impl ToOwned for FnPointerType { | ||
1174 | type Owned = TreeArc<FnPointerType>; | ||
1043 | fn to_owned(&self) -> TreeArc<FnPointerType> { TreeArc::cast(self.syntax.to_owned()) } | 1175 | fn to_owned(&self) -> TreeArc<FnPointerType> { TreeArc::cast(self.syntax.to_owned()) } |
1044 | } | 1176 | } |
1045 | 1177 | ||
@@ -1072,6 +1204,10 @@ impl AstNode for ForExpr { | |||
1072 | } | 1204 | } |
1073 | } | 1205 | } |
1074 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1206 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1207 | } | ||
1208 | |||
1209 | impl ToOwned for ForExpr { | ||
1210 | type Owned = TreeArc<ForExpr>; | ||
1075 | fn to_owned(&self) -> TreeArc<ForExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1211 | fn to_owned(&self) -> TreeArc<ForExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1076 | } | 1212 | } |
1077 | 1213 | ||
@@ -1105,6 +1241,10 @@ impl AstNode for ForType { | |||
1105 | } | 1241 | } |
1106 | } | 1242 | } |
1107 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1243 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1244 | } | ||
1245 | |||
1246 | impl ToOwned for ForType { | ||
1247 | type Owned = TreeArc<ForType>; | ||
1108 | fn to_owned(&self) -> TreeArc<ForType> { TreeArc::cast(self.syntax.to_owned()) } | 1248 | fn to_owned(&self) -> TreeArc<ForType> { TreeArc::cast(self.syntax.to_owned()) } |
1109 | } | 1249 | } |
1110 | 1250 | ||
@@ -1133,6 +1273,10 @@ impl AstNode for IfExpr { | |||
1133 | } | 1273 | } |
1134 | } | 1274 | } |
1135 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1275 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1276 | } | ||
1277 | |||
1278 | impl ToOwned for IfExpr { | ||
1279 | type Owned = TreeArc<IfExpr>; | ||
1136 | fn to_owned(&self) -> TreeArc<IfExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1280 | fn to_owned(&self) -> TreeArc<IfExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1137 | } | 1281 | } |
1138 | 1282 | ||
@@ -1161,6 +1305,10 @@ impl AstNode for ImplBlock { | |||
1161 | } | 1305 | } |
1162 | } | 1306 | } |
1163 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1307 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1308 | } | ||
1309 | |||
1310 | impl ToOwned for ImplBlock { | ||
1311 | type Owned = TreeArc<ImplBlock>; | ||
1164 | fn to_owned(&self) -> TreeArc<ImplBlock> { TreeArc::cast(self.syntax.to_owned()) } | 1312 | fn to_owned(&self) -> TreeArc<ImplBlock> { TreeArc::cast(self.syntax.to_owned()) } |
1165 | } | 1313 | } |
1166 | 1314 | ||
@@ -1198,6 +1346,10 @@ impl AstNode for ImplItem { | |||
1198 | } | 1346 | } |
1199 | } | 1347 | } |
1200 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1348 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1349 | } | ||
1350 | |||
1351 | impl ToOwned for ImplItem { | ||
1352 | type Owned = TreeArc<ImplItem>; | ||
1201 | fn to_owned(&self) -> TreeArc<ImplItem> { TreeArc::cast(self.syntax.to_owned()) } | 1353 | fn to_owned(&self) -> TreeArc<ImplItem> { TreeArc::cast(self.syntax.to_owned()) } |
1202 | } | 1354 | } |
1203 | 1355 | ||
@@ -1232,6 +1384,10 @@ impl AstNode for ImplTraitType { | |||
1232 | } | 1384 | } |
1233 | } | 1385 | } |
1234 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1386 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1387 | } | ||
1388 | |||
1389 | impl ToOwned for ImplTraitType { | ||
1390 | type Owned = TreeArc<ImplTraitType>; | ||
1235 | fn to_owned(&self) -> TreeArc<ImplTraitType> { TreeArc::cast(self.syntax.to_owned()) } | 1391 | fn to_owned(&self) -> TreeArc<ImplTraitType> { TreeArc::cast(self.syntax.to_owned()) } |
1236 | } | 1392 | } |
1237 | 1393 | ||
@@ -1256,6 +1412,10 @@ impl AstNode for IndexExpr { | |||
1256 | } | 1412 | } |
1257 | } | 1413 | } |
1258 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1414 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1415 | } | ||
1416 | |||
1417 | impl ToOwned for IndexExpr { | ||
1418 | type Owned = TreeArc<IndexExpr>; | ||
1259 | fn to_owned(&self) -> TreeArc<IndexExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1419 | fn to_owned(&self) -> TreeArc<IndexExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1260 | } | 1420 | } |
1261 | 1421 | ||
@@ -1280,6 +1440,10 @@ impl AstNode for IntNumber { | |||
1280 | } | 1440 | } |
1281 | } | 1441 | } |
1282 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1442 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1443 | } | ||
1444 | |||
1445 | impl ToOwned for IntNumber { | ||
1446 | type Owned = TreeArc<IntNumber>; | ||
1283 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } | 1447 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } |
1284 | } | 1448 | } |
1285 | 1449 | ||
@@ -1305,6 +1469,10 @@ impl AstNode for ItemList { | |||
1305 | } | 1469 | } |
1306 | } | 1470 | } |
1307 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1471 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1472 | } | ||
1473 | |||
1474 | impl ToOwned for ItemList { | ||
1475 | type Owned = TreeArc<ItemList>; | ||
1308 | fn to_owned(&self) -> TreeArc<ItemList> { TreeArc::cast(self.syntax.to_owned()) } | 1476 | fn to_owned(&self) -> TreeArc<ItemList> { TreeArc::cast(self.syntax.to_owned()) } |
1309 | } | 1477 | } |
1310 | 1478 | ||
@@ -1335,6 +1503,10 @@ impl AstNode for Label { | |||
1335 | } | 1503 | } |
1336 | } | 1504 | } |
1337 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1505 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1506 | } | ||
1507 | |||
1508 | impl ToOwned for Label { | ||
1509 | type Owned = TreeArc<Label>; | ||
1338 | fn to_owned(&self) -> TreeArc<Label> { TreeArc::cast(self.syntax.to_owned()) } | 1510 | fn to_owned(&self) -> TreeArc<Label> { TreeArc::cast(self.syntax.to_owned()) } |
1339 | } | 1511 | } |
1340 | 1512 | ||
@@ -1359,6 +1531,10 @@ impl AstNode for LambdaExpr { | |||
1359 | } | 1531 | } |
1360 | } | 1532 | } |
1361 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1533 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1534 | } | ||
1535 | |||
1536 | impl ToOwned for LambdaExpr { | ||
1537 | type Owned = TreeArc<LambdaExpr>; | ||
1362 | fn to_owned(&self) -> TreeArc<LambdaExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1538 | fn to_owned(&self) -> TreeArc<LambdaExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1363 | } | 1539 | } |
1364 | 1540 | ||
@@ -1391,6 +1567,10 @@ impl AstNode for LetStmt { | |||
1391 | } | 1567 | } |
1392 | } | 1568 | } |
1393 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1569 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1570 | } | ||
1571 | |||
1572 | impl ToOwned for LetStmt { | ||
1573 | type Owned = TreeArc<LetStmt>; | ||
1394 | fn to_owned(&self) -> TreeArc<LetStmt> { TreeArc::cast(self.syntax.to_owned()) } | 1574 | fn to_owned(&self) -> TreeArc<LetStmt> { TreeArc::cast(self.syntax.to_owned()) } |
1395 | } | 1575 | } |
1396 | 1576 | ||
@@ -1427,6 +1607,10 @@ impl AstNode for Lifetime { | |||
1427 | } | 1607 | } |
1428 | } | 1608 | } |
1429 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1609 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1610 | } | ||
1611 | |||
1612 | impl ToOwned for Lifetime { | ||
1613 | type Owned = TreeArc<Lifetime>; | ||
1430 | fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) } | 1614 | fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) } |
1431 | } | 1615 | } |
1432 | 1616 | ||
@@ -1452,6 +1636,10 @@ impl AstNode for LifetimeArg { | |||
1452 | } | 1636 | } |
1453 | } | 1637 | } |
1454 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1638 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1639 | } | ||
1640 | |||
1641 | impl ToOwned for LifetimeArg { | ||
1642 | type Owned = TreeArc<LifetimeArg>; | ||
1455 | fn to_owned(&self) -> TreeArc<LifetimeArg> { TreeArc::cast(self.syntax.to_owned()) } | 1643 | fn to_owned(&self) -> TreeArc<LifetimeArg> { TreeArc::cast(self.syntax.to_owned()) } |
1456 | } | 1644 | } |
1457 | 1645 | ||
@@ -1480,6 +1668,10 @@ impl AstNode for LifetimeParam { | |||
1480 | } | 1668 | } |
1481 | } | 1669 | } |
1482 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1670 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1671 | } | ||
1672 | |||
1673 | impl ToOwned for LifetimeParam { | ||
1674 | type Owned = TreeArc<LifetimeParam>; | ||
1483 | fn to_owned(&self) -> TreeArc<LifetimeParam> { TreeArc::cast(self.syntax.to_owned()) } | 1675 | fn to_owned(&self) -> TreeArc<LifetimeParam> { TreeArc::cast(self.syntax.to_owned()) } |
1484 | } | 1676 | } |
1485 | 1677 | ||
@@ -1508,6 +1700,10 @@ impl AstNode for Literal { | |||
1508 | } | 1700 | } |
1509 | } | 1701 | } |
1510 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1702 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1703 | } | ||
1704 | |||
1705 | impl ToOwned for Literal { | ||
1706 | type Owned = TreeArc<Literal>; | ||
1511 | fn to_owned(&self) -> TreeArc<Literal> { TreeArc::cast(self.syntax.to_owned()) } | 1707 | fn to_owned(&self) -> TreeArc<Literal> { TreeArc::cast(self.syntax.to_owned()) } |
1512 | } | 1708 | } |
1513 | 1709 | ||
@@ -1559,6 +1755,10 @@ impl AstNode for LiteralExpr { | |||
1559 | } | 1755 | } |
1560 | } | 1756 | } |
1561 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1757 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1758 | } | ||
1759 | |||
1760 | impl ToOwned for LiteralExpr { | ||
1761 | type Owned = TreeArc<LiteralExpr>; | ||
1562 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1762 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1563 | } | 1763 | } |
1564 | 1764 | ||
@@ -1600,6 +1800,10 @@ impl AstNode for LoopExpr { | |||
1600 | } | 1800 | } |
1601 | } | 1801 | } |
1602 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1802 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1803 | } | ||
1804 | |||
1805 | impl ToOwned for LoopExpr { | ||
1806 | type Owned = TreeArc<LoopExpr>; | ||
1603 | fn to_owned(&self) -> TreeArc<LoopExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1807 | fn to_owned(&self) -> TreeArc<LoopExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1604 | } | 1808 | } |
1605 | 1809 | ||
@@ -1625,6 +1829,10 @@ impl AstNode for MacroCall { | |||
1625 | } | 1829 | } |
1626 | } | 1830 | } |
1627 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1831 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1832 | } | ||
1833 | |||
1834 | impl ToOwned for MacroCall { | ||
1835 | type Owned = TreeArc<MacroCall>; | ||
1628 | fn to_owned(&self) -> TreeArc<MacroCall> { TreeArc::cast(self.syntax.to_owned()) } | 1836 | fn to_owned(&self) -> TreeArc<MacroCall> { TreeArc::cast(self.syntax.to_owned()) } |
1629 | } | 1837 | } |
1630 | 1838 | ||
@@ -1657,6 +1865,10 @@ impl AstNode for MatchArm { | |||
1657 | } | 1865 | } |
1658 | } | 1866 | } |
1659 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1867 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1868 | } | ||
1869 | |||
1870 | impl ToOwned for MatchArm { | ||
1871 | type Owned = TreeArc<MatchArm>; | ||
1660 | fn to_owned(&self) -> TreeArc<MatchArm> { TreeArc::cast(self.syntax.to_owned()) } | 1872 | fn to_owned(&self) -> TreeArc<MatchArm> { TreeArc::cast(self.syntax.to_owned()) } |
1661 | } | 1873 | } |
1662 | 1874 | ||
@@ -1693,6 +1905,10 @@ impl AstNode for MatchArmList { | |||
1693 | } | 1905 | } |
1694 | } | 1906 | } |
1695 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1907 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1908 | } | ||
1909 | |||
1910 | impl ToOwned for MatchArmList { | ||
1911 | type Owned = TreeArc<MatchArmList>; | ||
1696 | fn to_owned(&self) -> TreeArc<MatchArmList> { TreeArc::cast(self.syntax.to_owned()) } | 1912 | fn to_owned(&self) -> TreeArc<MatchArmList> { TreeArc::cast(self.syntax.to_owned()) } |
1697 | } | 1913 | } |
1698 | 1914 | ||
@@ -1721,6 +1937,10 @@ impl AstNode for MatchExpr { | |||
1721 | } | 1937 | } |
1722 | } | 1938 | } |
1723 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1939 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1940 | } | ||
1941 | |||
1942 | impl ToOwned for MatchExpr { | ||
1943 | type Owned = TreeArc<MatchExpr>; | ||
1724 | fn to_owned(&self) -> TreeArc<MatchExpr> { TreeArc::cast(self.syntax.to_owned()) } | 1944 | fn to_owned(&self) -> TreeArc<MatchExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1725 | } | 1945 | } |
1726 | 1946 | ||
@@ -1753,6 +1973,10 @@ impl AstNode for MatchGuard { | |||
1753 | } | 1973 | } |
1754 | } | 1974 | } |
1755 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1975 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1976 | } | ||
1977 | |||
1978 | impl ToOwned for MatchGuard { | ||
1979 | type Owned = TreeArc<MatchGuard>; | ||
1756 | fn to_owned(&self) -> TreeArc<MatchGuard> { TreeArc::cast(self.syntax.to_owned()) } | 1980 | fn to_owned(&self) -> TreeArc<MatchGuard> { TreeArc::cast(self.syntax.to_owned()) } |
1757 | } | 1981 | } |
1758 | 1982 | ||
@@ -1777,6 +2001,10 @@ impl AstNode for MethodCallExpr { | |||
1777 | } | 2001 | } |
1778 | } | 2002 | } |
1779 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2003 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2004 | } | ||
2005 | |||
2006 | impl ToOwned for MethodCallExpr { | ||
2007 | type Owned = TreeArc<MethodCallExpr>; | ||
1780 | fn to_owned(&self) -> TreeArc<MethodCallExpr> { TreeArc::cast(self.syntax.to_owned()) } | 2008 | fn to_owned(&self) -> TreeArc<MethodCallExpr> { TreeArc::cast(self.syntax.to_owned()) } |
1781 | } | 2009 | } |
1782 | 2010 | ||
@@ -1810,6 +2038,10 @@ impl AstNode for Module { | |||
1810 | } | 2038 | } |
1811 | } | 2039 | } |
1812 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2040 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2041 | } | ||
2042 | |||
2043 | impl ToOwned for Module { | ||
2044 | type Owned = TreeArc<Module>; | ||
1813 | fn to_owned(&self) -> TreeArc<Module> { TreeArc::cast(self.syntax.to_owned()) } | 2045 | fn to_owned(&self) -> TreeArc<Module> { TreeArc::cast(self.syntax.to_owned()) } |
1814 | } | 2046 | } |
1815 | 2047 | ||
@@ -1867,6 +2099,10 @@ impl AstNode for ModuleItem { | |||
1867 | } | 2099 | } |
1868 | } | 2100 | } |
1869 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2101 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2102 | } | ||
2103 | |||
2104 | impl ToOwned for ModuleItem { | ||
2105 | type Owned = TreeArc<ModuleItem>; | ||
1870 | fn to_owned(&self) -> TreeArc<ModuleItem> { TreeArc::cast(self.syntax.to_owned()) } | 2106 | fn to_owned(&self) -> TreeArc<ModuleItem> { TreeArc::cast(self.syntax.to_owned()) } |
1871 | } | 2107 | } |
1872 | 2108 | ||
@@ -1909,6 +2145,10 @@ impl AstNode for Name { | |||
1909 | } | 2145 | } |
1910 | } | 2146 | } |
1911 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2147 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2148 | } | ||
2149 | |||
2150 | impl ToOwned for Name { | ||
2151 | type Owned = TreeArc<Name>; | ||
1912 | fn to_owned(&self) -> TreeArc<Name> { TreeArc::cast(self.syntax.to_owned()) } | 2152 | fn to_owned(&self) -> TreeArc<Name> { TreeArc::cast(self.syntax.to_owned()) } |
1913 | } | 2153 | } |
1914 | 2154 | ||
@@ -1933,6 +2173,10 @@ impl AstNode for NameRef { | |||
1933 | } | 2173 | } |
1934 | } | 2174 | } |
1935 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2175 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2176 | } | ||
2177 | |||
2178 | impl ToOwned for NameRef { | ||
2179 | type Owned = TreeArc<NameRef>; | ||
1936 | fn to_owned(&self) -> TreeArc<NameRef> { TreeArc::cast(self.syntax.to_owned()) } | 2180 | fn to_owned(&self) -> TreeArc<NameRef> { TreeArc::cast(self.syntax.to_owned()) } |
1937 | } | 2181 | } |
1938 | 2182 | ||
@@ -1957,6 +2201,10 @@ impl AstNode for NamedField { | |||
1957 | } | 2201 | } |
1958 | } | 2202 | } |
1959 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2203 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2204 | } | ||
2205 | |||
2206 | impl ToOwned for NamedField { | ||
2207 | type Owned = TreeArc<NamedField>; | ||
1960 | fn to_owned(&self) -> TreeArc<NamedField> { TreeArc::cast(self.syntax.to_owned()) } | 2208 | fn to_owned(&self) -> TreeArc<NamedField> { TreeArc::cast(self.syntax.to_owned()) } |
1961 | } | 2209 | } |
1962 | 2210 | ||
@@ -1989,6 +2237,10 @@ impl AstNode for NamedFieldDef { | |||
1989 | } | 2237 | } |
1990 | } | 2238 | } |
1991 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2239 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2240 | } | ||
2241 | |||
2242 | impl ToOwned for NamedFieldDef { | ||
2243 | type Owned = TreeArc<NamedFieldDef>; | ||
1992 | fn to_owned(&self) -> TreeArc<NamedFieldDef> { TreeArc::cast(self.syntax.to_owned()) } | 2244 | fn to_owned(&self) -> TreeArc<NamedFieldDef> { TreeArc::cast(self.syntax.to_owned()) } |
1993 | } | 2245 | } |
1994 | 2246 | ||
@@ -2020,6 +2272,10 @@ impl AstNode for NamedFieldDefList { | |||
2020 | } | 2272 | } |
2021 | } | 2273 | } |
2022 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2274 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2275 | } | ||
2276 | |||
2277 | impl ToOwned for NamedFieldDefList { | ||
2278 | type Owned = TreeArc<NamedFieldDefList>; | ||
2023 | fn to_owned(&self) -> TreeArc<NamedFieldDefList> { TreeArc::cast(self.syntax.to_owned()) } | 2279 | fn to_owned(&self) -> TreeArc<NamedFieldDefList> { TreeArc::cast(self.syntax.to_owned()) } |
2024 | } | 2280 | } |
2025 | 2281 | ||
@@ -2048,6 +2304,10 @@ impl AstNode for NamedFieldList { | |||
2048 | } | 2304 | } |
2049 | } | 2305 | } |
2050 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2306 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2307 | } | ||
2308 | |||
2309 | impl ToOwned for NamedFieldList { | ||
2310 | type Owned = TreeArc<NamedFieldList>; | ||
2051 | fn to_owned(&self) -> TreeArc<NamedFieldList> { TreeArc::cast(self.syntax.to_owned()) } | 2311 | fn to_owned(&self) -> TreeArc<NamedFieldList> { TreeArc::cast(self.syntax.to_owned()) } |
2052 | } | 2312 | } |
2053 | 2313 | ||
@@ -2076,6 +2336,10 @@ impl AstNode for NeverType { | |||
2076 | } | 2336 | } |
2077 | } | 2337 | } |
2078 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2338 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2339 | } | ||
2340 | |||
2341 | impl ToOwned for NeverType { | ||
2342 | type Owned = TreeArc<NeverType>; | ||
2079 | fn to_owned(&self) -> TreeArc<NeverType> { TreeArc::cast(self.syntax.to_owned()) } | 2343 | fn to_owned(&self) -> TreeArc<NeverType> { TreeArc::cast(self.syntax.to_owned()) } |
2080 | } | 2344 | } |
2081 | 2345 | ||
@@ -2107,6 +2371,10 @@ impl AstNode for NominalDef { | |||
2107 | } | 2371 | } |
2108 | } | 2372 | } |
2109 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2373 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2374 | } | ||
2375 | |||
2376 | impl ToOwned for NominalDef { | ||
2377 | type Owned = TreeArc<NominalDef>; | ||
2110 | fn to_owned(&self) -> TreeArc<NominalDef> { TreeArc::cast(self.syntax.to_owned()) } | 2378 | fn to_owned(&self) -> TreeArc<NominalDef> { TreeArc::cast(self.syntax.to_owned()) } |
2111 | } | 2379 | } |
2112 | 2380 | ||
@@ -2143,6 +2411,10 @@ impl AstNode for Param { | |||
2143 | } | 2411 | } |
2144 | } | 2412 | } |
2145 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2413 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2414 | } | ||
2415 | |||
2416 | impl ToOwned for Param { | ||
2417 | type Owned = TreeArc<Param>; | ||
2146 | fn to_owned(&self) -> TreeArc<Param> { TreeArc::cast(self.syntax.to_owned()) } | 2418 | fn to_owned(&self) -> TreeArc<Param> { TreeArc::cast(self.syntax.to_owned()) } |
2147 | } | 2419 | } |
2148 | 2420 | ||
@@ -2175,6 +2447,10 @@ impl AstNode for ParamList { | |||
2175 | } | 2447 | } |
2176 | } | 2448 | } |
2177 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2449 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2450 | } | ||
2451 | |||
2452 | impl ToOwned for ParamList { | ||
2453 | type Owned = TreeArc<ParamList>; | ||
2178 | fn to_owned(&self) -> TreeArc<ParamList> { TreeArc::cast(self.syntax.to_owned()) } | 2454 | fn to_owned(&self) -> TreeArc<ParamList> { TreeArc::cast(self.syntax.to_owned()) } |
2179 | } | 2455 | } |
2180 | 2456 | ||
@@ -2207,6 +2483,10 @@ impl AstNode for ParenExpr { | |||
2207 | } | 2483 | } |
2208 | } | 2484 | } |
2209 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2485 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2486 | } | ||
2487 | |||
2488 | impl ToOwned for ParenExpr { | ||
2489 | type Owned = TreeArc<ParenExpr>; | ||
2210 | fn to_owned(&self) -> TreeArc<ParenExpr> { TreeArc::cast(self.syntax.to_owned()) } | 2490 | fn to_owned(&self) -> TreeArc<ParenExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2211 | } | 2491 | } |
2212 | 2492 | ||
@@ -2235,6 +2515,10 @@ impl AstNode for ParenType { | |||
2235 | } | 2515 | } |
2236 | } | 2516 | } |
2237 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2517 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2518 | } | ||
2519 | |||
2520 | impl ToOwned for ParenType { | ||
2521 | type Owned = TreeArc<ParenType>; | ||
2238 | fn to_owned(&self) -> TreeArc<ParenType> { TreeArc::cast(self.syntax.to_owned()) } | 2522 | fn to_owned(&self) -> TreeArc<ParenType> { TreeArc::cast(self.syntax.to_owned()) } |
2239 | } | 2523 | } |
2240 | 2524 | ||
@@ -2284,6 +2568,10 @@ impl AstNode for Pat { | |||
2284 | } | 2568 | } |
2285 | } | 2569 | } |
2286 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2570 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2571 | } | ||
2572 | |||
2573 | impl ToOwned for Pat { | ||
2574 | type Owned = TreeArc<Pat>; | ||
2287 | fn to_owned(&self) -> TreeArc<Pat> { TreeArc::cast(self.syntax.to_owned()) } | 2575 | fn to_owned(&self) -> TreeArc<Pat> { TreeArc::cast(self.syntax.to_owned()) } |
2288 | } | 2576 | } |
2289 | 2577 | ||
@@ -2324,6 +2612,10 @@ impl AstNode for Path { | |||
2324 | } | 2612 | } |
2325 | } | 2613 | } |
2326 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2614 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2615 | } | ||
2616 | |||
2617 | impl ToOwned for Path { | ||
2618 | type Owned = TreeArc<Path>; | ||
2327 | fn to_owned(&self) -> TreeArc<Path> { TreeArc::cast(self.syntax.to_owned()) } | 2619 | fn to_owned(&self) -> TreeArc<Path> { TreeArc::cast(self.syntax.to_owned()) } |
2328 | } | 2620 | } |
2329 | 2621 | ||
@@ -2356,6 +2648,10 @@ impl AstNode for PathExpr { | |||
2356 | } | 2648 | } |
2357 | } | 2649 | } |
2358 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2650 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2651 | } | ||
2652 | |||
2653 | impl ToOwned for PathExpr { | ||
2654 | type Owned = TreeArc<PathExpr>; | ||
2359 | fn to_owned(&self) -> TreeArc<PathExpr> { TreeArc::cast(self.syntax.to_owned()) } | 2655 | fn to_owned(&self) -> TreeArc<PathExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2360 | } | 2656 | } |
2361 | 2657 | ||
@@ -2384,6 +2680,10 @@ impl AstNode for PathPat { | |||
2384 | } | 2680 | } |
2385 | } | 2681 | } |
2386 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2683 | } | ||
2684 | |||
2685 | impl ToOwned for PathPat { | ||
2686 | type Owned = TreeArc<PathPat>; | ||
2387 | fn to_owned(&self) -> TreeArc<PathPat> { TreeArc::cast(self.syntax.to_owned()) } | 2687 | fn to_owned(&self) -> TreeArc<PathPat> { TreeArc::cast(self.syntax.to_owned()) } |
2388 | } | 2688 | } |
2389 | 2689 | ||
@@ -2412,6 +2712,10 @@ impl AstNode for PathSegment { | |||
2412 | } | 2712 | } |
2413 | } | 2713 | } |
2414 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2714 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2715 | } | ||
2716 | |||
2717 | impl ToOwned for PathSegment { | ||
2718 | type Owned = TreeArc<PathSegment>; | ||
2415 | fn to_owned(&self) -> TreeArc<PathSegment> { TreeArc::cast(self.syntax.to_owned()) } | 2719 | fn to_owned(&self) -> TreeArc<PathSegment> { TreeArc::cast(self.syntax.to_owned()) } |
2416 | } | 2720 | } |
2417 | 2721 | ||
@@ -2444,6 +2748,10 @@ impl AstNode for PathType { | |||
2444 | } | 2748 | } |
2445 | } | 2749 | } |
2446 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2750 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2751 | } | ||
2752 | |||
2753 | impl ToOwned for PathType { | ||
2754 | type Owned = TreeArc<PathType>; | ||
2447 | fn to_owned(&self) -> TreeArc<PathType> { TreeArc::cast(self.syntax.to_owned()) } | 2755 | fn to_owned(&self) -> TreeArc<PathType> { TreeArc::cast(self.syntax.to_owned()) } |
2448 | } | 2756 | } |
2449 | 2757 | ||
@@ -2472,6 +2780,10 @@ impl AstNode for PlaceholderPat { | |||
2472 | } | 2780 | } |
2473 | } | 2781 | } |
2474 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2782 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2783 | } | ||
2784 | |||
2785 | impl ToOwned for PlaceholderPat { | ||
2786 | type Owned = TreeArc<PlaceholderPat>; | ||
2475 | fn to_owned(&self) -> TreeArc<PlaceholderPat> { TreeArc::cast(self.syntax.to_owned()) } | 2787 | fn to_owned(&self) -> TreeArc<PlaceholderPat> { TreeArc::cast(self.syntax.to_owned()) } |
2476 | } | 2788 | } |
2477 | 2789 | ||
@@ -2496,6 +2808,10 @@ impl AstNode for PlaceholderType { | |||
2496 | } | 2808 | } |
2497 | } | 2809 | } |
2498 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2810 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2811 | } | ||
2812 | |||
2813 | impl ToOwned for PlaceholderType { | ||
2814 | type Owned = TreeArc<PlaceholderType>; | ||
2499 | fn to_owned(&self) -> TreeArc<PlaceholderType> { TreeArc::cast(self.syntax.to_owned()) } | 2815 | fn to_owned(&self) -> TreeArc<PlaceholderType> { TreeArc::cast(self.syntax.to_owned()) } |
2500 | } | 2816 | } |
2501 | 2817 | ||
@@ -2520,6 +2836,10 @@ impl AstNode for PointerType { | |||
2520 | } | 2836 | } |
2521 | } | 2837 | } |
2522 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2838 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2839 | } | ||
2840 | |||
2841 | impl ToOwned for PointerType { | ||
2842 | type Owned = TreeArc<PointerType>; | ||
2523 | fn to_owned(&self) -> TreeArc<PointerType> { TreeArc::cast(self.syntax.to_owned()) } | 2843 | fn to_owned(&self) -> TreeArc<PointerType> { TreeArc::cast(self.syntax.to_owned()) } |
2524 | } | 2844 | } |
2525 | 2845 | ||
@@ -2548,6 +2868,10 @@ impl AstNode for PosField { | |||
2548 | } | 2868 | } |
2549 | } | 2869 | } |
2550 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2870 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2871 | } | ||
2872 | |||
2873 | impl ToOwned for PosField { | ||
2874 | type Owned = TreeArc<PosField>; | ||
2551 | fn to_owned(&self) -> TreeArc<PosField> { TreeArc::cast(self.syntax.to_owned()) } | 2875 | fn to_owned(&self) -> TreeArc<PosField> { TreeArc::cast(self.syntax.to_owned()) } |
2552 | } | 2876 | } |
2553 | 2877 | ||
@@ -2578,6 +2902,10 @@ impl AstNode for PosFieldList { | |||
2578 | } | 2902 | } |
2579 | } | 2903 | } |
2580 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2904 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2905 | } | ||
2906 | |||
2907 | impl ToOwned for PosFieldList { | ||
2908 | type Owned = TreeArc<PosFieldList>; | ||
2581 | fn to_owned(&self) -> TreeArc<PosFieldList> { TreeArc::cast(self.syntax.to_owned()) } | 2909 | fn to_owned(&self) -> TreeArc<PosFieldList> { TreeArc::cast(self.syntax.to_owned()) } |
2582 | } | 2910 | } |
2583 | 2911 | ||
@@ -2606,6 +2934,10 @@ impl AstNode for PrefixExpr { | |||
2606 | } | 2934 | } |
2607 | } | 2935 | } |
2608 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2936 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2937 | } | ||
2938 | |||
2939 | impl ToOwned for PrefixExpr { | ||
2940 | type Owned = TreeArc<PrefixExpr>; | ||
2609 | fn to_owned(&self) -> TreeArc<PrefixExpr> { TreeArc::cast(self.syntax.to_owned()) } | 2941 | fn to_owned(&self) -> TreeArc<PrefixExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2610 | } | 2942 | } |
2611 | 2943 | ||
@@ -2634,6 +2966,10 @@ impl AstNode for RangeExpr { | |||
2634 | } | 2966 | } |
2635 | } | 2967 | } |
2636 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2968 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2969 | } | ||
2970 | |||
2971 | impl ToOwned for RangeExpr { | ||
2972 | type Owned = TreeArc<RangeExpr>; | ||
2637 | fn to_owned(&self) -> TreeArc<RangeExpr> { TreeArc::cast(self.syntax.to_owned()) } | 2973 | fn to_owned(&self) -> TreeArc<RangeExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2638 | } | 2974 | } |
2639 | 2975 | ||
@@ -2658,6 +2994,10 @@ impl AstNode for RangePat { | |||
2658 | } | 2994 | } |
2659 | } | 2995 | } |
2660 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2996 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2997 | } | ||
2998 | |||
2999 | impl ToOwned for RangePat { | ||
3000 | type Owned = TreeArc<RangePat>; | ||
2661 | fn to_owned(&self) -> TreeArc<RangePat> { TreeArc::cast(self.syntax.to_owned()) } | 3001 | fn to_owned(&self) -> TreeArc<RangePat> { TreeArc::cast(self.syntax.to_owned()) } |
2662 | } | 3002 | } |
2663 | 3003 | ||
@@ -2682,6 +3022,10 @@ impl AstNode for RawByteString { | |||
2682 | } | 3022 | } |
2683 | } | 3023 | } |
2684 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3024 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3025 | } | ||
3026 | |||
3027 | impl ToOwned for RawByteString { | ||
3028 | type Owned = TreeArc<RawByteString>; | ||
2685 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } | 3029 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } |
2686 | } | 3030 | } |
2687 | 3031 | ||
@@ -2707,6 +3051,10 @@ impl AstNode for RawString { | |||
2707 | } | 3051 | } |
2708 | } | 3052 | } |
2709 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3053 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3054 | } | ||
3055 | |||
3056 | impl ToOwned for RawString { | ||
3057 | type Owned = TreeArc<RawString>; | ||
2710 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } | 3058 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } |
2711 | } | 3059 | } |
2712 | 3060 | ||
@@ -2732,6 +3080,10 @@ impl AstNode for RefExpr { | |||
2732 | } | 3080 | } |
2733 | } | 3081 | } |
2734 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3082 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3083 | } | ||
3084 | |||
3085 | impl ToOwned for RefExpr { | ||
3086 | type Owned = TreeArc<RefExpr>; | ||
2735 | fn to_owned(&self) -> TreeArc<RefExpr> { TreeArc::cast(self.syntax.to_owned()) } | 3087 | fn to_owned(&self) -> TreeArc<RefExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2736 | } | 3088 | } |
2737 | 3089 | ||
@@ -2760,6 +3112,10 @@ impl AstNode for RefPat { | |||
2760 | } | 3112 | } |
2761 | } | 3113 | } |
2762 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3114 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3115 | } | ||
3116 | |||
3117 | impl ToOwned for RefPat { | ||
3118 | type Owned = TreeArc<RefPat>; | ||
2763 | fn to_owned(&self) -> TreeArc<RefPat> { TreeArc::cast(self.syntax.to_owned()) } | 3119 | fn to_owned(&self) -> TreeArc<RefPat> { TreeArc::cast(self.syntax.to_owned()) } |
2764 | } | 3120 | } |
2765 | 3121 | ||
@@ -2788,6 +3144,10 @@ impl AstNode for ReferenceType { | |||
2788 | } | 3144 | } |
2789 | } | 3145 | } |
2790 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3146 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3147 | } | ||
3148 | |||
3149 | impl ToOwned for ReferenceType { | ||
3150 | type Owned = TreeArc<ReferenceType>; | ||
2791 | fn to_owned(&self) -> TreeArc<ReferenceType> { TreeArc::cast(self.syntax.to_owned()) } | 3151 | fn to_owned(&self) -> TreeArc<ReferenceType> { TreeArc::cast(self.syntax.to_owned()) } |
2792 | } | 3152 | } |
2793 | 3153 | ||
@@ -2816,6 +3176,10 @@ impl AstNode for RetType { | |||
2816 | } | 3176 | } |
2817 | } | 3177 | } |
2818 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3178 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3179 | } | ||
3180 | |||
3181 | impl ToOwned for RetType { | ||
3182 | type Owned = TreeArc<RetType>; | ||
2819 | fn to_owned(&self) -> TreeArc<RetType> { TreeArc::cast(self.syntax.to_owned()) } | 3183 | fn to_owned(&self) -> TreeArc<RetType> { TreeArc::cast(self.syntax.to_owned()) } |
2820 | } | 3184 | } |
2821 | 3185 | ||
@@ -2844,6 +3208,10 @@ impl AstNode for ReturnExpr { | |||
2844 | } | 3208 | } |
2845 | } | 3209 | } |
2846 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3210 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3211 | } | ||
3212 | |||
3213 | impl ToOwned for ReturnExpr { | ||
3214 | type Owned = TreeArc<ReturnExpr>; | ||
2847 | fn to_owned(&self) -> TreeArc<ReturnExpr> { TreeArc::cast(self.syntax.to_owned()) } | 3215 | fn to_owned(&self) -> TreeArc<ReturnExpr> { TreeArc::cast(self.syntax.to_owned()) } |
2848 | } | 3216 | } |
2849 | 3217 | ||
@@ -2872,6 +3240,10 @@ impl AstNode for SelfKw { | |||
2872 | } | 3240 | } |
2873 | } | 3241 | } |
2874 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3242 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3243 | } | ||
3244 | |||
3245 | impl ToOwned for SelfKw { | ||
3246 | type Owned = TreeArc<SelfKw>; | ||
2875 | fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) } | 3247 | fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) } |
2876 | } | 3248 | } |
2877 | 3249 | ||
@@ -2896,6 +3268,10 @@ impl AstNode for SelfParam { | |||
2896 | } | 3268 | } |
2897 | } | 3269 | } |
2898 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3270 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3271 | } | ||
3272 | |||
3273 | impl ToOwned for SelfParam { | ||
3274 | type Owned = TreeArc<SelfParam>; | ||
2899 | fn to_owned(&self) -> TreeArc<SelfParam> { TreeArc::cast(self.syntax.to_owned()) } | 3275 | fn to_owned(&self) -> TreeArc<SelfParam> { TreeArc::cast(self.syntax.to_owned()) } |
2900 | } | 3276 | } |
2901 | 3277 | ||
@@ -2928,6 +3304,10 @@ impl AstNode for SlicePat { | |||
2928 | } | 3304 | } |
2929 | } | 3305 | } |
2930 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3306 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3307 | } | ||
3308 | |||
3309 | impl ToOwned for SlicePat { | ||
3310 | type Owned = TreeArc<SlicePat>; | ||
2931 | fn to_owned(&self) -> TreeArc<SlicePat> { TreeArc::cast(self.syntax.to_owned()) } | 3311 | fn to_owned(&self) -> TreeArc<SlicePat> { TreeArc::cast(self.syntax.to_owned()) } |
2932 | } | 3312 | } |
2933 | 3313 | ||
@@ -2952,6 +3332,10 @@ impl AstNode for SliceType { | |||
2952 | } | 3332 | } |
2953 | } | 3333 | } |
2954 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3334 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3335 | } | ||
3336 | |||
3337 | impl ToOwned for SliceType { | ||
3338 | type Owned = TreeArc<SliceType>; | ||
2955 | fn to_owned(&self) -> TreeArc<SliceType> { TreeArc::cast(self.syntax.to_owned()) } | 3339 | fn to_owned(&self) -> TreeArc<SliceType> { TreeArc::cast(self.syntax.to_owned()) } |
2956 | } | 3340 | } |
2957 | 3341 | ||
@@ -2980,6 +3364,10 @@ impl AstNode for SourceFile { | |||
2980 | } | 3364 | } |
2981 | } | 3365 | } |
2982 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3366 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3367 | } | ||
3368 | |||
3369 | impl ToOwned for SourceFile { | ||
3370 | type Owned = TreeArc<SourceFile>; | ||
2983 | fn to_owned(&self) -> TreeArc<SourceFile> { TreeArc::cast(self.syntax.to_owned()) } | 3371 | fn to_owned(&self) -> TreeArc<SourceFile> { TreeArc::cast(self.syntax.to_owned()) } |
2984 | } | 3372 | } |
2985 | 3373 | ||
@@ -3010,6 +3398,10 @@ impl AstNode for StaticDef { | |||
3010 | } | 3398 | } |
3011 | } | 3399 | } |
3012 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3400 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3401 | } | ||
3402 | |||
3403 | impl ToOwned for StaticDef { | ||
3404 | type Owned = TreeArc<StaticDef>; | ||
3013 | fn to_owned(&self) -> TreeArc<StaticDef> { TreeArc::cast(self.syntax.to_owned()) } | 3405 | fn to_owned(&self) -> TreeArc<StaticDef> { TreeArc::cast(self.syntax.to_owned()) } |
3014 | } | 3406 | } |
3015 | 3407 | ||
@@ -3050,6 +3442,10 @@ impl AstNode for Stmt { | |||
3050 | } | 3442 | } |
3051 | } | 3443 | } |
3052 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3444 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3445 | } | ||
3446 | |||
3447 | impl ToOwned for Stmt { | ||
3448 | type Owned = TreeArc<Stmt>; | ||
3053 | fn to_owned(&self) -> TreeArc<Stmt> { TreeArc::cast(self.syntax.to_owned()) } | 3449 | fn to_owned(&self) -> TreeArc<Stmt> { TreeArc::cast(self.syntax.to_owned()) } |
3054 | } | 3450 | } |
3055 | 3451 | ||
@@ -3083,6 +3479,10 @@ impl AstNode for String { | |||
3083 | } | 3479 | } |
3084 | } | 3480 | } |
3085 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3481 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3482 | } | ||
3483 | |||
3484 | impl ToOwned for String { | ||
3485 | type Owned = TreeArc<String>; | ||
3086 | fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) } | 3486 | fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) } |
3087 | } | 3487 | } |
3088 | 3488 | ||
@@ -3108,6 +3508,10 @@ impl AstNode for StructDef { | |||
3108 | } | 3508 | } |
3109 | } | 3509 | } |
3110 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3510 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3511 | } | ||
3512 | |||
3513 | impl ToOwned for StructDef { | ||
3514 | type Owned = TreeArc<StructDef>; | ||
3111 | fn to_owned(&self) -> TreeArc<StructDef> { TreeArc::cast(self.syntax.to_owned()) } | 3515 | fn to_owned(&self) -> TreeArc<StructDef> { TreeArc::cast(self.syntax.to_owned()) } |
3112 | } | 3516 | } |
3113 | 3517 | ||
@@ -3137,6 +3541,10 @@ impl AstNode for StructLit { | |||
3137 | } | 3541 | } |
3138 | } | 3542 | } |
3139 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3543 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3544 | } | ||
3545 | |||
3546 | impl ToOwned for StructLit { | ||
3547 | type Owned = TreeArc<StructLit>; | ||
3140 | fn to_owned(&self) -> TreeArc<StructLit> { TreeArc::cast(self.syntax.to_owned()) } | 3548 | fn to_owned(&self) -> TreeArc<StructLit> { TreeArc::cast(self.syntax.to_owned()) } |
3141 | } | 3549 | } |
3142 | 3550 | ||
@@ -3173,6 +3581,10 @@ impl AstNode for StructPat { | |||
3173 | } | 3581 | } |
3174 | } | 3582 | } |
3175 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3583 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3584 | } | ||
3585 | |||
3586 | impl ToOwned for StructPat { | ||
3587 | type Owned = TreeArc<StructPat>; | ||
3176 | fn to_owned(&self) -> TreeArc<StructPat> { TreeArc::cast(self.syntax.to_owned()) } | 3588 | fn to_owned(&self) -> TreeArc<StructPat> { TreeArc::cast(self.syntax.to_owned()) } |
3177 | } | 3589 | } |
3178 | 3590 | ||
@@ -3205,6 +3617,10 @@ impl AstNode for TokenTree { | |||
3205 | } | 3617 | } |
3206 | } | 3618 | } |
3207 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3619 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3620 | } | ||
3621 | |||
3622 | impl ToOwned for TokenTree { | ||
3623 | type Owned = TreeArc<TokenTree>; | ||
3208 | fn to_owned(&self) -> TreeArc<TokenTree> { TreeArc::cast(self.syntax.to_owned()) } | 3624 | fn to_owned(&self) -> TreeArc<TokenTree> { TreeArc::cast(self.syntax.to_owned()) } |
3209 | } | 3625 | } |
3210 | 3626 | ||
@@ -3229,6 +3645,10 @@ impl AstNode for TraitDef { | |||
3229 | } | 3645 | } |
3230 | } | 3646 | } |
3231 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3647 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3648 | } | ||
3649 | |||
3650 | impl ToOwned for TraitDef { | ||
3651 | type Owned = TreeArc<TraitDef>; | ||
3232 | fn to_owned(&self) -> TreeArc<TraitDef> { TreeArc::cast(self.syntax.to_owned()) } | 3652 | fn to_owned(&self) -> TreeArc<TraitDef> { TreeArc::cast(self.syntax.to_owned()) } |
3233 | } | 3653 | } |
3234 | 3654 | ||
@@ -3237,6 +3657,7 @@ impl ast::VisibilityOwner for TraitDef {} | |||
3237 | impl ast::NameOwner for TraitDef {} | 3657 | impl ast::NameOwner for TraitDef {} |
3238 | impl ast::AttrsOwner for TraitDef {} | 3658 | impl ast::AttrsOwner for TraitDef {} |
3239 | impl ast::DocCommentsOwner for TraitDef {} | 3659 | impl ast::DocCommentsOwner for TraitDef {} |
3660 | impl ast::TypeParamsOwner for TraitDef {} | ||
3240 | impl TraitDef {} | 3661 | impl TraitDef {} |
3241 | 3662 | ||
3242 | // TrueKw | 3663 | // TrueKw |
@@ -3257,6 +3678,10 @@ impl AstNode for TrueKw { | |||
3257 | } | 3678 | } |
3258 | } | 3679 | } |
3259 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3680 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3681 | } | ||
3682 | |||
3683 | impl ToOwned for TrueKw { | ||
3684 | type Owned = TreeArc<TrueKw>; | ||
3260 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } | 3685 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } |
3261 | } | 3686 | } |
3262 | 3687 | ||
@@ -3282,6 +3707,10 @@ impl AstNode for TryExpr { | |||
3282 | } | 3707 | } |
3283 | } | 3708 | } |
3284 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3709 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3710 | } | ||
3711 | |||
3712 | impl ToOwned for TryExpr { | ||
3713 | type Owned = TreeArc<TryExpr>; | ||
3285 | fn to_owned(&self) -> TreeArc<TryExpr> { TreeArc::cast(self.syntax.to_owned()) } | 3714 | fn to_owned(&self) -> TreeArc<TryExpr> { TreeArc::cast(self.syntax.to_owned()) } |
3286 | } | 3715 | } |
3287 | 3716 | ||
@@ -3310,6 +3739,10 @@ impl AstNode for TupleExpr { | |||
3310 | } | 3739 | } |
3311 | } | 3740 | } |
3312 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3741 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3742 | } | ||
3743 | |||
3744 | impl ToOwned for TupleExpr { | ||
3745 | type Owned = TreeArc<TupleExpr>; | ||
3313 | fn to_owned(&self) -> TreeArc<TupleExpr> { TreeArc::cast(self.syntax.to_owned()) } | 3746 | fn to_owned(&self) -> TreeArc<TupleExpr> { TreeArc::cast(self.syntax.to_owned()) } |
3314 | } | 3747 | } |
3315 | 3748 | ||
@@ -3338,6 +3771,10 @@ impl AstNode for TuplePat { | |||
3338 | } | 3771 | } |
3339 | } | 3772 | } |
3340 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3773 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3774 | } | ||
3775 | |||
3776 | impl ToOwned for TuplePat { | ||
3777 | type Owned = TreeArc<TuplePat>; | ||
3341 | fn to_owned(&self) -> TreeArc<TuplePat> { TreeArc::cast(self.syntax.to_owned()) } | 3778 | fn to_owned(&self) -> TreeArc<TuplePat> { TreeArc::cast(self.syntax.to_owned()) } |
3342 | } | 3779 | } |
3343 | 3780 | ||
@@ -3366,6 +3803,10 @@ impl AstNode for TupleStructPat { | |||
3366 | } | 3803 | } |
3367 | } | 3804 | } |
3368 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3805 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3806 | } | ||
3807 | |||
3808 | impl ToOwned for TupleStructPat { | ||
3809 | type Owned = TreeArc<TupleStructPat>; | ||
3369 | fn to_owned(&self) -> TreeArc<TupleStructPat> { TreeArc::cast(self.syntax.to_owned()) } | 3810 | fn to_owned(&self) -> TreeArc<TupleStructPat> { TreeArc::cast(self.syntax.to_owned()) } |
3370 | } | 3811 | } |
3371 | 3812 | ||
@@ -3398,6 +3839,10 @@ impl AstNode for TupleType { | |||
3398 | } | 3839 | } |
3399 | } | 3840 | } |
3400 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3841 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3842 | } | ||
3843 | |||
3844 | impl ToOwned for TupleType { | ||
3845 | type Owned = TreeArc<TupleType>; | ||
3401 | fn to_owned(&self) -> TreeArc<TupleType> { TreeArc::cast(self.syntax.to_owned()) } | 3846 | fn to_owned(&self) -> TreeArc<TupleType> { TreeArc::cast(self.syntax.to_owned()) } |
3402 | } | 3847 | } |
3403 | 3848 | ||
@@ -3426,6 +3871,10 @@ impl AstNode for TypeArg { | |||
3426 | } | 3871 | } |
3427 | } | 3872 | } |
3428 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3873 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3874 | } | ||
3875 | |||
3876 | impl ToOwned for TypeArg { | ||
3877 | type Owned = TreeArc<TypeArg>; | ||
3429 | fn to_owned(&self) -> TreeArc<TypeArg> { TreeArc::cast(self.syntax.to_owned()) } | 3878 | fn to_owned(&self) -> TreeArc<TypeArg> { TreeArc::cast(self.syntax.to_owned()) } |
3430 | } | 3879 | } |
3431 | 3880 | ||
@@ -3454,6 +3903,10 @@ impl AstNode for TypeArgList { | |||
3454 | } | 3903 | } |
3455 | } | 3904 | } |
3456 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3905 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3906 | } | ||
3907 | |||
3908 | impl ToOwned for TypeArgList { | ||
3909 | type Owned = TreeArc<TypeArgList>; | ||
3457 | fn to_owned(&self) -> TreeArc<TypeArgList> { TreeArc::cast(self.syntax.to_owned()) } | 3910 | fn to_owned(&self) -> TreeArc<TypeArgList> { TreeArc::cast(self.syntax.to_owned()) } |
3458 | } | 3911 | } |
3459 | 3912 | ||
@@ -3490,6 +3943,10 @@ impl AstNode for TypeDef { | |||
3490 | } | 3943 | } |
3491 | } | 3944 | } |
3492 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3945 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3946 | } | ||
3947 | |||
3948 | impl ToOwned for TypeDef { | ||
3949 | type Owned = TreeArc<TypeDef>; | ||
3493 | fn to_owned(&self) -> TreeArc<TypeDef> { TreeArc::cast(self.syntax.to_owned()) } | 3950 | fn to_owned(&self) -> TreeArc<TypeDef> { TreeArc::cast(self.syntax.to_owned()) } |
3494 | } | 3951 | } |
3495 | 3952 | ||
@@ -3523,6 +3980,10 @@ impl AstNode for TypeParam { | |||
3523 | } | 3980 | } |
3524 | } | 3981 | } |
3525 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 3982 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
3983 | } | ||
3984 | |||
3985 | impl ToOwned for TypeParam { | ||
3986 | type Owned = TreeArc<TypeParam>; | ||
3526 | fn to_owned(&self) -> TreeArc<TypeParam> { TreeArc::cast(self.syntax.to_owned()) } | 3987 | fn to_owned(&self) -> TreeArc<TypeParam> { TreeArc::cast(self.syntax.to_owned()) } |
3527 | } | 3988 | } |
3528 | 3989 | ||
@@ -3548,6 +4009,10 @@ impl AstNode for TypeParamList { | |||
3548 | } | 4009 | } |
3549 | } | 4010 | } |
3550 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4011 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4012 | } | ||
4013 | |||
4014 | impl ToOwned for TypeParamList { | ||
4015 | type Owned = TreeArc<TypeParamList>; | ||
3551 | fn to_owned(&self) -> TreeArc<TypeParamList> { TreeArc::cast(self.syntax.to_owned()) } | 4016 | fn to_owned(&self) -> TreeArc<TypeParamList> { TreeArc::cast(self.syntax.to_owned()) } |
3552 | } | 4017 | } |
3553 | 4018 | ||
@@ -3609,6 +4074,10 @@ impl AstNode for TypeRef { | |||
3609 | } | 4074 | } |
3610 | } | 4075 | } |
3611 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4076 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4077 | } | ||
4078 | |||
4079 | impl ToOwned for TypeRef { | ||
4080 | type Owned = TreeArc<TypeRef>; | ||
3612 | fn to_owned(&self) -> TreeArc<TypeRef> { TreeArc::cast(self.syntax.to_owned()) } | 4081 | fn to_owned(&self) -> TreeArc<TypeRef> { TreeArc::cast(self.syntax.to_owned()) } |
3613 | } | 4082 | } |
3614 | 4083 | ||
@@ -3653,6 +4122,10 @@ impl AstNode for UseItem { | |||
3653 | } | 4122 | } |
3654 | } | 4123 | } |
3655 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4124 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4125 | } | ||
4126 | |||
4127 | impl ToOwned for UseItem { | ||
4128 | type Owned = TreeArc<UseItem>; | ||
3656 | fn to_owned(&self) -> TreeArc<UseItem> { TreeArc::cast(self.syntax.to_owned()) } | 4129 | fn to_owned(&self) -> TreeArc<UseItem> { TreeArc::cast(self.syntax.to_owned()) } |
3657 | } | 4130 | } |
3658 | 4131 | ||
@@ -3681,6 +4154,10 @@ impl AstNode for UseTree { | |||
3681 | } | 4154 | } |
3682 | } | 4155 | } |
3683 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4156 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4157 | } | ||
4158 | |||
4159 | impl ToOwned for UseTree { | ||
4160 | type Owned = TreeArc<UseTree>; | ||
3684 | fn to_owned(&self) -> TreeArc<UseTree> { TreeArc::cast(self.syntax.to_owned()) } | 4161 | fn to_owned(&self) -> TreeArc<UseTree> { TreeArc::cast(self.syntax.to_owned()) } |
3685 | } | 4162 | } |
3686 | 4163 | ||
@@ -3713,6 +4190,10 @@ impl AstNode for UseTreeList { | |||
3713 | } | 4190 | } |
3714 | } | 4191 | } |
3715 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4192 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4193 | } | ||
4194 | |||
4195 | impl ToOwned for UseTreeList { | ||
4196 | type Owned = TreeArc<UseTreeList>; | ||
3716 | fn to_owned(&self) -> TreeArc<UseTreeList> { TreeArc::cast(self.syntax.to_owned()) } | 4197 | fn to_owned(&self) -> TreeArc<UseTreeList> { TreeArc::cast(self.syntax.to_owned()) } |
3717 | } | 4198 | } |
3718 | 4199 | ||
@@ -3741,6 +4222,10 @@ impl AstNode for Visibility { | |||
3741 | } | 4222 | } |
3742 | } | 4223 | } |
3743 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4224 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4225 | } | ||
4226 | |||
4227 | impl ToOwned for Visibility { | ||
4228 | type Owned = TreeArc<Visibility>; | ||
3744 | fn to_owned(&self) -> TreeArc<Visibility> { TreeArc::cast(self.syntax.to_owned()) } | 4229 | fn to_owned(&self) -> TreeArc<Visibility> { TreeArc::cast(self.syntax.to_owned()) } |
3745 | } | 4230 | } |
3746 | 4231 | ||
@@ -3765,6 +4250,10 @@ impl AstNode for WhereClause { | |||
3765 | } | 4250 | } |
3766 | } | 4251 | } |
3767 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4252 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4253 | } | ||
4254 | |||
4255 | impl ToOwned for WhereClause { | ||
4256 | type Owned = TreeArc<WhereClause>; | ||
3768 | fn to_owned(&self) -> TreeArc<WhereClause> { TreeArc::cast(self.syntax.to_owned()) } | 4257 | fn to_owned(&self) -> TreeArc<WhereClause> { TreeArc::cast(self.syntax.to_owned()) } |
3769 | } | 4258 | } |
3770 | 4259 | ||
@@ -3789,6 +4278,10 @@ impl AstNode for WhileExpr { | |||
3789 | } | 4278 | } |
3790 | } | 4279 | } |
3791 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4280 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4281 | } | ||
4282 | |||
4283 | impl ToOwned for WhileExpr { | ||
4284 | type Owned = TreeArc<WhileExpr>; | ||
3792 | fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) } | 4285 | fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) } |
3793 | } | 4286 | } |
3794 | 4287 | ||
@@ -3818,6 +4311,10 @@ impl AstNode for Whitespace { | |||
3818 | } | 4311 | } |
3819 | } | 4312 | } |
3820 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4313 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4314 | } | ||
4315 | |||
4316 | impl ToOwned for Whitespace { | ||
4317 | type Owned = TreeArc<Whitespace>; | ||
3821 | fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) } | 4318 | fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) } |
3822 | } | 4319 | } |
3823 | 4320 | ||
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera index bf9db4ee8..ea0fc35fd 100644 --- a/crates/ra_syntax/src/ast/generated.rs.tera +++ b/crates/ra_syntax/src/ast/generated.rs.tera | |||
@@ -48,6 +48,10 @@ impl AstNode for {{ node }} { | |||
48 | } | 48 | } |
49 | } | 49 | } |
50 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 50 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
51 | } | ||
52 | |||
53 | impl ToOwned for {{ node }} { | ||
54 | type Owned = TreeArc<{{ node }}>; | ||
51 | fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) } | 55 | fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) } |
52 | } | 56 | } |
53 | 57 | ||
@@ -79,6 +83,10 @@ impl AstNode for {{ node }} { | |||
79 | } | 83 | } |
80 | } | 84 | } |
81 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 85 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
86 | } | ||
87 | |||
88 | impl ToOwned for {{ node }} { | ||
89 | type Owned = TreeArc<{{ node }}>; | ||
82 | fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) } | 90 | fn to_owned(&self) -> TreeArc<{{ node }}> { TreeArc::cast(self.syntax.to_owned()) } |
83 | } | 91 | } |
84 | 92 | ||
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 9a6f990b6..cb5d6cde8 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron | |||
@@ -280,7 +280,7 @@ Grammar( | |||
280 | ], options: [["variant_list", "EnumVariantList"]] ), | 280 | ], options: [["variant_list", "EnumVariantList"]] ), |
281 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), | 281 | "EnumVariantList": ( collections: [["variants", "EnumVariant"]] ), |
282 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), | 282 | "EnumVariant": ( traits: ["NameOwner", "DocCommentsOwner"], options: ["Expr"] ), |
283 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner"] ), | 283 | "TraitDef": ( traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner", "TypeParamsOwner"] ), |
284 | "Module": ( | 284 | "Module": ( |
285 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], | 285 | traits: ["VisibilityOwner", "NameOwner", "AttrsOwner", "DocCommentsOwner" ], |
286 | options: [ "ItemList" ] | 286 | options: [ "ItemList" ] |
@@ -498,7 +498,7 @@ Grammar( | |||
498 | ), | 498 | ), |
499 | 499 | ||
500 | "RefPat": ( options: [ "Pat" ]), | 500 | "RefPat": ( options: [ "Pat" ]), |
501 | "BindPat": ( | 501 | "BindPat": ( |
502 | options: [ "Pat" ], | 502 | options: [ "Pat" ], |
503 | traits: ["NameOwner"] | 503 | traits: ["NameOwner"] |
504 | ), | 504 | ), |
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs index 2236555e0..7ee32fa7c 100644 --- a/crates/ra_syntax/src/grammar/expressions.rs +++ b/crates/ra_syntax/src/grammar/expressions.rs | |||
@@ -305,6 +305,8 @@ fn postfix_expr( | |||
305 | // fn foo() { | 305 | // fn foo() { |
306 | // let _ = f(); | 306 | // let _ = f(); |
307 | // let _ = f()(1)(1, 2,); | 307 | // let _ = f()(1)(1, 2,); |
308 | // let _ = f(<Foo>::func()); | ||
309 | // f(<Foo as Trait>::func()); | ||
308 | // } | 310 | // } |
309 | fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 311 | fn call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
310 | assert!(p.at(L_PAREN)); | 312 | assert!(p.at(L_PAREN)); |
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 167a76551..6d6d89f70 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -36,26 +36,22 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | // E.g. for after the break in `if break {}`, this should not match | 38 | // E.g. for after the break in `if break {}`, this should not match |
39 | pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ | 39 | pub(super) const ATOM_EXPR_FIRST: TokenSet = |
40 | L_PAREN, | 40 | LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ |
41 | L_CURLY, | 41 | L_PAREN, |
42 | L_BRACK, | 42 | L_CURLY, |
43 | PIPE, | 43 | L_BRACK, |
44 | MOVE_KW, | 44 | PIPE, |
45 | IF_KW, | 45 | MOVE_KW, |
46 | WHILE_KW, | 46 | IF_KW, |
47 | MATCH_KW, | 47 | WHILE_KW, |
48 | UNSAFE_KW, | 48 | MATCH_KW, |
49 | RETURN_KW, | 49 | UNSAFE_KW, |
50 | IDENT, | 50 | RETURN_KW, |
51 | SELF_KW, | 51 | BREAK_KW, |
52 | SUPER_KW, | 52 | CONTINUE_KW, |
53 | CRATE_KW, | 53 | LIFETIME, |
54 | COLONCOLON, | 54 | ]); |
55 | BREAK_KW, | ||
56 | CONTINUE_KW, | ||
57 | LIFETIME, | ||
58 | ]); | ||
59 | 55 | ||
60 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; | 56 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; |
61 | 57 | ||
diff --git a/crates/ra_syntax/src/yellow.rs b/crates/ra_syntax/src/yellow.rs index a7bfb80e2..ed48739f8 100644 --- a/crates/ra_syntax/src/yellow.rs +++ b/crates/ra_syntax/src/yellow.rs | |||
@@ -2,10 +2,11 @@ mod builder; | |||
2 | pub mod syntax_error; | 2 | pub mod syntax_error; |
3 | mod syntax_text; | 3 | mod syntax_text; |
4 | 4 | ||
5 | use std::{fmt, borrow::Borrow}; | ||
6 | |||
5 | use self::syntax_text::SyntaxText; | 7 | use self::syntax_text::SyntaxText; |
6 | use crate::{SmolStr, SyntaxKind, TextRange}; | 8 | use crate::{SmolStr, SyntaxKind, TextRange}; |
7 | use rowan::{Types, TransparentNewType}; | 9 | use rowan::{Types, TransparentNewType}; |
8 | use std::fmt; | ||
9 | 10 | ||
10 | pub(crate) use self::builder::GreenBuilder; | 11 | pub(crate) use self::builder::GreenBuilder; |
11 | pub use self::syntax_error::{SyntaxError, SyntaxErrorKind, Location}; | 12 | pub use self::syntax_error::{SyntaxError, SyntaxErrorKind, Location}; |
@@ -25,6 +26,12 @@ pub struct TreeArc<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>>( | |||
25 | pub(crate) rowan::TreeArc<RaTypes, T>, | 26 | pub(crate) rowan::TreeArc<RaTypes, T>, |
26 | ); | 27 | ); |
27 | 28 | ||
29 | impl<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>> Borrow<T> for TreeArc<T> { | ||
30 | fn borrow(&self) -> &T { | ||
31 | &*self | ||
32 | } | ||
33 | } | ||
34 | |||
28 | impl<T> TreeArc<T> | 35 | impl<T> TreeArc<T> |
29 | where | 36 | where |
30 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, | 37 | T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>, |
@@ -124,6 +131,14 @@ impl SyntaxNode { | |||
124 | } | 131 | } |
125 | } | 132 | } |
126 | 133 | ||
134 | impl ToOwned for SyntaxNode { | ||
135 | type Owned = TreeArc<SyntaxNode>; | ||
136 | fn to_owned(&self) -> TreeArc<SyntaxNode> { | ||
137 | let ptr = TreeArc(self.0.to_owned()); | ||
138 | TreeArc::cast(ptr) | ||
139 | } | ||
140 | } | ||
141 | |||
127 | impl SyntaxNode { | 142 | impl SyntaxNode { |
128 | pub(crate) fn root_data(&self) -> &Vec<SyntaxError> { | 143 | pub(crate) fn root_data(&self) -> &Vec<SyntaxError> { |
129 | self.0.root_data() | 144 | self.0.root_data() |
@@ -133,11 +148,6 @@ impl SyntaxNode { | |||
133 | self.0.replace_self(replacement) | 148 | self.0.replace_self(replacement) |
134 | } | 149 | } |
135 | 150 | ||
136 | pub fn to_owned(&self) -> TreeArc<SyntaxNode> { | ||
137 | let ptr = TreeArc(self.0.to_owned()); | ||
138 | TreeArc::cast(ptr) | ||
139 | } | ||
140 | |||
141 | pub fn kind(&self) -> SyntaxKind { | 151 | pub fn kind(&self) -> SyntaxKind { |
142 | self.0.kind() | 152 | self.0.kind() |
143 | } | 153 | } |