diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 650 |
1 files changed, 112 insertions, 538 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 84f39cda1..0376c91c8 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -376,64 +376,6 @@ impl BreakExpr { | |||
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | // Byte | ||
380 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
381 | #[repr(transparent)] | ||
382 | pub struct Byte { | ||
383 | pub(crate) syntax: SyntaxNode, | ||
384 | } | ||
385 | unsafe impl TransparentNewType for Byte { | ||
386 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
387 | } | ||
388 | |||
389 | impl AstNode for Byte { | ||
390 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
391 | match syntax.kind() { | ||
392 | BYTE => Some(Byte::from_repr(syntax.into_repr())), | ||
393 | _ => None, | ||
394 | } | ||
395 | } | ||
396 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
397 | } | ||
398 | |||
399 | impl ToOwned for Byte { | ||
400 | type Owned = TreeArc<Byte>; | ||
401 | fn to_owned(&self) -> TreeArc<Byte> { TreeArc::cast(self.syntax.to_owned()) } | ||
402 | } | ||
403 | |||
404 | |||
405 | impl ast::AstToken for Byte {} | ||
406 | impl Byte {} | ||
407 | |||
408 | // ByteString | ||
409 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
410 | #[repr(transparent)] | ||
411 | pub struct ByteString { | ||
412 | pub(crate) syntax: SyntaxNode, | ||
413 | } | ||
414 | unsafe impl TransparentNewType for ByteString { | ||
415 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
416 | } | ||
417 | |||
418 | impl AstNode for ByteString { | ||
419 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
420 | match syntax.kind() { | ||
421 | BYTE_STRING => Some(ByteString::from_repr(syntax.into_repr())), | ||
422 | _ => None, | ||
423 | } | ||
424 | } | ||
425 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
426 | } | ||
427 | |||
428 | impl ToOwned for ByteString { | ||
429 | type Owned = TreeArc<ByteString>; | ||
430 | fn to_owned(&self) -> TreeArc<ByteString> { TreeArc::cast(self.syntax.to_owned()) } | ||
431 | } | ||
432 | |||
433 | |||
434 | impl ast::AstToken for ByteString {} | ||
435 | impl ByteString {} | ||
436 | |||
437 | // CallExpr | 379 | // CallExpr |
438 | #[derive(Debug, PartialEq, Eq, Hash)] | 380 | #[derive(Debug, PartialEq, Eq, Hash)] |
439 | #[repr(transparent)] | 381 | #[repr(transparent)] |
@@ -503,64 +445,6 @@ impl CastExpr { | |||
503 | } | 445 | } |
504 | } | 446 | } |
505 | 447 | ||
506 | // Char | ||
507 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
508 | #[repr(transparent)] | ||
509 | pub struct Char { | ||
510 | pub(crate) syntax: SyntaxNode, | ||
511 | } | ||
512 | unsafe impl TransparentNewType for Char { | ||
513 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
514 | } | ||
515 | |||
516 | impl AstNode for Char { | ||
517 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
518 | match syntax.kind() { | ||
519 | CHAR => Some(Char::from_repr(syntax.into_repr())), | ||
520 | _ => None, | ||
521 | } | ||
522 | } | ||
523 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
524 | } | ||
525 | |||
526 | impl ToOwned for Char { | ||
527 | type Owned = TreeArc<Char>; | ||
528 | fn to_owned(&self) -> TreeArc<Char> { TreeArc::cast(self.syntax.to_owned()) } | ||
529 | } | ||
530 | |||
531 | |||
532 | impl ast::AstToken for Char {} | ||
533 | impl Char {} | ||
534 | |||
535 | // Comment | ||
536 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
537 | #[repr(transparent)] | ||
538 | pub struct Comment { | ||
539 | pub(crate) syntax: SyntaxNode, | ||
540 | } | ||
541 | unsafe impl TransparentNewType for Comment { | ||
542 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
543 | } | ||
544 | |||
545 | impl AstNode for Comment { | ||
546 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
547 | match syntax.kind() { | ||
548 | COMMENT => Some(Comment::from_repr(syntax.into_repr())), | ||
549 | _ => None, | ||
550 | } | ||
551 | } | ||
552 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
553 | } | ||
554 | |||
555 | impl ToOwned for Comment { | ||
556 | type Owned = TreeArc<Comment>; | ||
557 | fn to_owned(&self) -> TreeArc<Comment> { TreeArc::cast(self.syntax.to_owned()) } | ||
558 | } | ||
559 | |||
560 | |||
561 | impl ast::AstToken for Comment {} | ||
562 | impl Comment {} | ||
563 | |||
564 | // Condition | 448 | // Condition |
565 | #[derive(Debug, PartialEq, Eq, Hash)] | 449 | #[derive(Debug, PartialEq, Eq, Hash)] |
566 | #[repr(transparent)] | 450 | #[repr(transparent)] |
@@ -689,6 +573,7 @@ impl ToOwned for DynTraitType { | |||
689 | } | 573 | } |
690 | 574 | ||
691 | 575 | ||
576 | impl ast::TypeBoundsOwner for DynTraitType {} | ||
692 | impl DynTraitType {} | 577 | impl DynTraitType {} |
693 | 578 | ||
694 | // EnumDef | 579 | // EnumDef |
@@ -834,6 +719,7 @@ pub enum ExprKind<'a> { | |||
834 | RangeExpr(&'a RangeExpr), | 719 | RangeExpr(&'a RangeExpr), |
835 | BinExpr(&'a BinExpr), | 720 | BinExpr(&'a BinExpr), |
836 | Literal(&'a Literal), | 721 | Literal(&'a Literal), |
722 | MacroCall(&'a MacroCall), | ||
837 | } | 723 | } |
838 | impl<'a> From<&'a TupleExpr> for &'a Expr { | 724 | impl<'a> From<&'a TupleExpr> for &'a Expr { |
839 | fn from(n: &'a TupleExpr) -> &'a Expr { | 725 | fn from(n: &'a TupleExpr) -> &'a Expr { |
@@ -970,6 +856,11 @@ impl<'a> From<&'a Literal> for &'a Expr { | |||
970 | Expr::cast(&n.syntax).unwrap() | 856 | Expr::cast(&n.syntax).unwrap() |
971 | } | 857 | } |
972 | } | 858 | } |
859 | impl<'a> From<&'a MacroCall> for &'a Expr { | ||
860 | fn from(n: &'a MacroCall) -> &'a Expr { | ||
861 | Expr::cast(&n.syntax).unwrap() | ||
862 | } | ||
863 | } | ||
973 | 864 | ||
974 | 865 | ||
975 | impl AstNode for Expr { | 866 | impl AstNode for Expr { |
@@ -1001,7 +892,8 @@ impl AstNode for Expr { | |||
1001 | | PREFIX_EXPR | 892 | | PREFIX_EXPR |
1002 | | RANGE_EXPR | 893 | | RANGE_EXPR |
1003 | | BIN_EXPR | 894 | | BIN_EXPR |
1004 | | LITERAL => Some(Expr::from_repr(syntax.into_repr())), | 895 | | LITERAL |
896 | | MACRO_CALL => Some(Expr::from_repr(syntax.into_repr())), | ||
1005 | _ => None, | 897 | _ => None, |
1006 | } | 898 | } |
1007 | } | 899 | } |
@@ -1043,6 +935,7 @@ impl Expr { | |||
1043 | RANGE_EXPR => ExprKind::RangeExpr(RangeExpr::cast(&self.syntax).unwrap()), | 935 | RANGE_EXPR => ExprKind::RangeExpr(RangeExpr::cast(&self.syntax).unwrap()), |
1044 | BIN_EXPR => ExprKind::BinExpr(BinExpr::cast(&self.syntax).unwrap()), | 936 | BIN_EXPR => ExprKind::BinExpr(BinExpr::cast(&self.syntax).unwrap()), |
1045 | LITERAL => ExprKind::Literal(Literal::cast(&self.syntax).unwrap()), | 937 | LITERAL => ExprKind::Literal(Literal::cast(&self.syntax).unwrap()), |
938 | MACRO_CALL => ExprKind::MacroCall(MacroCall::cast(&self.syntax).unwrap()), | ||
1046 | _ => unreachable!(), | 939 | _ => unreachable!(), |
1047 | } | 940 | } |
1048 | } | 941 | } |
@@ -1118,35 +1011,6 @@ impl ExternCrateItem { | |||
1118 | } | 1011 | } |
1119 | } | 1012 | } |
1120 | 1013 | ||
1121 | // FalseKw | ||
1122 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1123 | #[repr(transparent)] | ||
1124 | pub struct FalseKw { | ||
1125 | pub(crate) syntax: SyntaxNode, | ||
1126 | } | ||
1127 | unsafe impl TransparentNewType for FalseKw { | ||
1128 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1129 | } | ||
1130 | |||
1131 | impl AstNode for FalseKw { | ||
1132 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1133 | match syntax.kind() { | ||
1134 | FALSE_KW => Some(FalseKw::from_repr(syntax.into_repr())), | ||
1135 | _ => None, | ||
1136 | } | ||
1137 | } | ||
1138 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1139 | } | ||
1140 | |||
1141 | impl ToOwned for FalseKw { | ||
1142 | type Owned = TreeArc<FalseKw>; | ||
1143 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
1144 | } | ||
1145 | |||
1146 | |||
1147 | impl ast::AstToken for FalseKw {} | ||
1148 | impl FalseKw {} | ||
1149 | |||
1150 | // FieldExpr | 1014 | // FieldExpr |
1151 | #[derive(Debug, PartialEq, Eq, Hash)] | 1015 | #[derive(Debug, PartialEq, Eq, Hash)] |
1152 | #[repr(transparent)] | 1016 | #[repr(transparent)] |
@@ -1252,35 +1116,6 @@ impl FieldPatList { | |||
1252 | } | 1116 | } |
1253 | } | 1117 | } |
1254 | 1118 | ||
1255 | // FloatNumber | ||
1256 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1257 | #[repr(transparent)] | ||
1258 | pub struct FloatNumber { | ||
1259 | pub(crate) syntax: SyntaxNode, | ||
1260 | } | ||
1261 | unsafe impl TransparentNewType for FloatNumber { | ||
1262 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1263 | } | ||
1264 | |||
1265 | impl AstNode for FloatNumber { | ||
1266 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1267 | match syntax.kind() { | ||
1268 | FLOAT_NUMBER => Some(FloatNumber::from_repr(syntax.into_repr())), | ||
1269 | _ => None, | ||
1270 | } | ||
1271 | } | ||
1272 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1273 | } | ||
1274 | |||
1275 | impl ToOwned for FloatNumber { | ||
1276 | type Owned = TreeArc<FloatNumber>; | ||
1277 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1278 | } | ||
1279 | |||
1280 | |||
1281 | impl ast::AstToken for FloatNumber {} | ||
1282 | impl FloatNumber {} | ||
1283 | |||
1284 | // FnDef | 1119 | // FnDef |
1285 | #[derive(Debug, PartialEq, Eq, Hash)] | 1120 | #[derive(Debug, PartialEq, Eq, Hash)] |
1286 | #[repr(transparent)] | 1121 | #[repr(transparent)] |
@@ -1585,6 +1420,7 @@ impl ToOwned for ImplTraitType { | |||
1585 | } | 1420 | } |
1586 | 1421 | ||
1587 | 1422 | ||
1423 | impl ast::TypeBoundsOwner for ImplTraitType {} | ||
1588 | impl ImplTraitType {} | 1424 | impl ImplTraitType {} |
1589 | 1425 | ||
1590 | // IndexExpr | 1426 | // IndexExpr |
@@ -1615,35 +1451,6 @@ impl ToOwned for IndexExpr { | |||
1615 | 1451 | ||
1616 | impl IndexExpr {} | 1452 | impl IndexExpr {} |
1617 | 1453 | ||
1618 | // IntNumber | ||
1619 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1620 | #[repr(transparent)] | ||
1621 | pub struct IntNumber { | ||
1622 | pub(crate) syntax: SyntaxNode, | ||
1623 | } | ||
1624 | unsafe impl TransparentNewType for IntNumber { | ||
1625 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1626 | } | ||
1627 | |||
1628 | impl AstNode for IntNumber { | ||
1629 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1630 | match syntax.kind() { | ||
1631 | INT_NUMBER => Some(IntNumber::from_repr(syntax.into_repr())), | ||
1632 | _ => None, | ||
1633 | } | ||
1634 | } | ||
1635 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1636 | } | ||
1637 | |||
1638 | impl ToOwned for IntNumber { | ||
1639 | type Owned = TreeArc<IntNumber>; | ||
1640 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1641 | } | ||
1642 | |||
1643 | |||
1644 | impl ast::AstToken for IntNumber {} | ||
1645 | impl IntNumber {} | ||
1646 | |||
1647 | // ItemList | 1454 | // ItemList |
1648 | #[derive(Debug, PartialEq, Eq, Hash)] | 1455 | #[derive(Debug, PartialEq, Eq, Hash)] |
1649 | #[repr(transparent)] | 1456 | #[repr(transparent)] |
@@ -1779,35 +1586,6 @@ impl LetStmt { | |||
1779 | } | 1586 | } |
1780 | } | 1587 | } |
1781 | 1588 | ||
1782 | // Lifetime | ||
1783 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1784 | #[repr(transparent)] | ||
1785 | pub struct Lifetime { | ||
1786 | pub(crate) syntax: SyntaxNode, | ||
1787 | } | ||
1788 | unsafe impl TransparentNewType for Lifetime { | ||
1789 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1790 | } | ||
1791 | |||
1792 | impl AstNode for Lifetime { | ||
1793 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1794 | match syntax.kind() { | ||
1795 | LIFETIME => Some(Lifetime::from_repr(syntax.into_repr())), | ||
1796 | _ => None, | ||
1797 | } | ||
1798 | } | ||
1799 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1800 | } | ||
1801 | |||
1802 | impl ToOwned for Lifetime { | ||
1803 | type Owned = TreeArc<Lifetime>; | ||
1804 | fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) } | ||
1805 | } | ||
1806 | |||
1807 | |||
1808 | impl ast::AstToken for Lifetime {} | ||
1809 | impl Lifetime {} | ||
1810 | |||
1811 | // LifetimeArg | 1589 | // LifetimeArg |
1812 | #[derive(Debug, PartialEq, Eq, Hash)] | 1590 | #[derive(Debug, PartialEq, Eq, Hash)] |
1813 | #[repr(transparent)] | 1591 | #[repr(transparent)] |
@@ -1834,11 +1612,7 @@ impl ToOwned for LifetimeArg { | |||
1834 | } | 1612 | } |
1835 | 1613 | ||
1836 | 1614 | ||
1837 | impl LifetimeArg { | 1615 | impl LifetimeArg {} |
1838 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1839 | super::child_opt(self) | ||
1840 | } | ||
1841 | } | ||
1842 | 1616 | ||
1843 | // LifetimeParam | 1617 | // LifetimeParam |
1844 | #[derive(Debug, PartialEq, Eq, Hash)] | 1618 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1867,11 +1641,7 @@ impl ToOwned for LifetimeParam { | |||
1867 | 1641 | ||
1868 | 1642 | ||
1869 | impl ast::AttrsOwner for LifetimeParam {} | 1643 | impl ast::AttrsOwner for LifetimeParam {} |
1870 | impl LifetimeParam { | 1644 | impl LifetimeParam {} |
1871 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1872 | super::child_opt(self) | ||
1873 | } | ||
1874 | } | ||
1875 | 1645 | ||
1876 | // Literal | 1646 | // Literal |
1877 | #[derive(Debug, PartialEq, Eq, Hash)] | 1647 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1899,130 +1669,7 @@ impl ToOwned for Literal { | |||
1899 | } | 1669 | } |
1900 | 1670 | ||
1901 | 1671 | ||
1902 | impl Literal { | 1672 | impl Literal {} |
1903 | pub fn literal_expr(&self) -> Option<&LiteralExpr> { | ||
1904 | super::child_opt(self) | ||
1905 | } | ||
1906 | } | ||
1907 | |||
1908 | // LiteralExpr | ||
1909 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1910 | #[repr(transparent)] | ||
1911 | pub struct LiteralExpr { | ||
1912 | pub(crate) syntax: SyntaxNode, | ||
1913 | } | ||
1914 | unsafe impl TransparentNewType for LiteralExpr { | ||
1915 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1916 | } | ||
1917 | |||
1918 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
1919 | pub enum LiteralExprKind<'a> { | ||
1920 | String(&'a String), | ||
1921 | ByteString(&'a ByteString), | ||
1922 | RawString(&'a RawString), | ||
1923 | RawByteString(&'a RawByteString), | ||
1924 | Char(&'a Char), | ||
1925 | Byte(&'a Byte), | ||
1926 | IntNumber(&'a IntNumber), | ||
1927 | FloatNumber(&'a FloatNumber), | ||
1928 | TrueKw(&'a TrueKw), | ||
1929 | FalseKw(&'a FalseKw), | ||
1930 | } | ||
1931 | impl<'a> From<&'a String> for &'a LiteralExpr { | ||
1932 | fn from(n: &'a String) -> &'a LiteralExpr { | ||
1933 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1934 | } | ||
1935 | } | ||
1936 | impl<'a> From<&'a ByteString> for &'a LiteralExpr { | ||
1937 | fn from(n: &'a ByteString) -> &'a LiteralExpr { | ||
1938 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1939 | } | ||
1940 | } | ||
1941 | impl<'a> From<&'a RawString> for &'a LiteralExpr { | ||
1942 | fn from(n: &'a RawString) -> &'a LiteralExpr { | ||
1943 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1944 | } | ||
1945 | } | ||
1946 | impl<'a> From<&'a RawByteString> for &'a LiteralExpr { | ||
1947 | fn from(n: &'a RawByteString) -> &'a LiteralExpr { | ||
1948 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1949 | } | ||
1950 | } | ||
1951 | impl<'a> From<&'a Char> for &'a LiteralExpr { | ||
1952 | fn from(n: &'a Char) -> &'a LiteralExpr { | ||
1953 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1954 | } | ||
1955 | } | ||
1956 | impl<'a> From<&'a Byte> for &'a LiteralExpr { | ||
1957 | fn from(n: &'a Byte) -> &'a LiteralExpr { | ||
1958 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1959 | } | ||
1960 | } | ||
1961 | impl<'a> From<&'a IntNumber> for &'a LiteralExpr { | ||
1962 | fn from(n: &'a IntNumber) -> &'a LiteralExpr { | ||
1963 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1964 | } | ||
1965 | } | ||
1966 | impl<'a> From<&'a FloatNumber> for &'a LiteralExpr { | ||
1967 | fn from(n: &'a FloatNumber) -> &'a LiteralExpr { | ||
1968 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1969 | } | ||
1970 | } | ||
1971 | impl<'a> From<&'a TrueKw> for &'a LiteralExpr { | ||
1972 | fn from(n: &'a TrueKw) -> &'a LiteralExpr { | ||
1973 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1974 | } | ||
1975 | } | ||
1976 | impl<'a> From<&'a FalseKw> for &'a LiteralExpr { | ||
1977 | fn from(n: &'a FalseKw) -> &'a LiteralExpr { | ||
1978 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1979 | } | ||
1980 | } | ||
1981 | |||
1982 | |||
1983 | impl AstNode for LiteralExpr { | ||
1984 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1985 | match syntax.kind() { | ||
1986 | | STRING | ||
1987 | | BYTE_STRING | ||
1988 | | RAW_STRING | ||
1989 | | RAW_BYTE_STRING | ||
1990 | | CHAR | ||
1991 | | BYTE | ||
1992 | | INT_NUMBER | ||
1993 | | FLOAT_NUMBER | ||
1994 | | TRUE_KW | ||
1995 | | FALSE_KW => Some(LiteralExpr::from_repr(syntax.into_repr())), | ||
1996 | _ => None, | ||
1997 | } | ||
1998 | } | ||
1999 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2000 | } | ||
2001 | |||
2002 | impl ToOwned for LiteralExpr { | ||
2003 | type Owned = TreeArc<LiteralExpr>; | ||
2004 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } | ||
2005 | } | ||
2006 | |||
2007 | impl LiteralExpr { | ||
2008 | pub fn kind(&self) -> LiteralExprKind { | ||
2009 | match self.syntax.kind() { | ||
2010 | STRING => LiteralExprKind::String(String::cast(&self.syntax).unwrap()), | ||
2011 | BYTE_STRING => LiteralExprKind::ByteString(ByteString::cast(&self.syntax).unwrap()), | ||
2012 | RAW_STRING => LiteralExprKind::RawString(RawString::cast(&self.syntax).unwrap()), | ||
2013 | RAW_BYTE_STRING => LiteralExprKind::RawByteString(RawByteString::cast(&self.syntax).unwrap()), | ||
2014 | CHAR => LiteralExprKind::Char(Char::cast(&self.syntax).unwrap()), | ||
2015 | BYTE => LiteralExprKind::Byte(Byte::cast(&self.syntax).unwrap()), | ||
2016 | INT_NUMBER => LiteralExprKind::IntNumber(IntNumber::cast(&self.syntax).unwrap()), | ||
2017 | FLOAT_NUMBER => LiteralExprKind::FloatNumber(FloatNumber::cast(&self.syntax).unwrap()), | ||
2018 | TRUE_KW => LiteralExprKind::TrueKw(TrueKw::cast(&self.syntax).unwrap()), | ||
2019 | FALSE_KW => LiteralExprKind::FalseKw(FalseKw::cast(&self.syntax).unwrap()), | ||
2020 | _ => unreachable!(), | ||
2021 | } | ||
2022 | } | ||
2023 | } | ||
2024 | |||
2025 | impl LiteralExpr {} | ||
2026 | 1673 | ||
2027 | // LiteralPat | 1674 | // LiteralPat |
2028 | #[derive(Debug, PartialEq, Eq, Hash)] | 1675 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3406,64 +3053,6 @@ impl ToOwned for RangePat { | |||
3406 | 3053 | ||
3407 | impl RangePat {} | 3054 | impl RangePat {} |
3408 | 3055 | ||
3409 | // RawByteString | ||
3410 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3411 | #[repr(transparent)] | ||
3412 | pub struct RawByteString { | ||
3413 | pub(crate) syntax: SyntaxNode, | ||
3414 | } | ||
3415 | unsafe impl TransparentNewType for RawByteString { | ||
3416 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3417 | } | ||
3418 | |||
3419 | impl AstNode for RawByteString { | ||
3420 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3421 | match syntax.kind() { | ||
3422 | RAW_BYTE_STRING => Some(RawByteString::from_repr(syntax.into_repr())), | ||
3423 | _ => None, | ||
3424 | } | ||
3425 | } | ||
3426 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3427 | } | ||
3428 | |||
3429 | impl ToOwned for RawByteString { | ||
3430 | type Owned = TreeArc<RawByteString>; | ||
3431 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3432 | } | ||
3433 | |||
3434 | |||
3435 | impl ast::AstToken for RawByteString {} | ||
3436 | impl RawByteString {} | ||
3437 | |||
3438 | // RawString | ||
3439 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3440 | #[repr(transparent)] | ||
3441 | pub struct RawString { | ||
3442 | pub(crate) syntax: SyntaxNode, | ||
3443 | } | ||
3444 | unsafe impl TransparentNewType for RawString { | ||
3445 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3446 | } | ||
3447 | |||
3448 | impl AstNode for RawString { | ||
3449 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3450 | match syntax.kind() { | ||
3451 | RAW_STRING => Some(RawString::from_repr(syntax.into_repr())), | ||
3452 | _ => None, | ||
3453 | } | ||
3454 | } | ||
3455 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3456 | } | ||
3457 | |||
3458 | impl ToOwned for RawString { | ||
3459 | type Owned = TreeArc<RawString>; | ||
3460 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3461 | } | ||
3462 | |||
3463 | |||
3464 | impl ast::AstToken for RawString {} | ||
3465 | impl RawString {} | ||
3466 | |||
3467 | // RefExpr | 3056 | // RefExpr |
3468 | #[derive(Debug, PartialEq, Eq, Hash)] | 3057 | #[derive(Debug, PartialEq, Eq, Hash)] |
3469 | #[repr(transparent)] | 3058 | #[repr(transparent)] |
@@ -3624,34 +3213,6 @@ impl ReturnExpr { | |||
3624 | } | 3213 | } |
3625 | } | 3214 | } |
3626 | 3215 | ||
3627 | // SelfKw | ||
3628 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3629 | #[repr(transparent)] | ||
3630 | pub struct SelfKw { | ||
3631 | pub(crate) syntax: SyntaxNode, | ||
3632 | } | ||
3633 | unsafe impl TransparentNewType for SelfKw { | ||
3634 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3635 | } | ||
3636 | |||
3637 | impl AstNode for SelfKw { | ||
3638 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3639 | match syntax.kind() { | ||
3640 | SELF_KW => Some(SelfKw::from_repr(syntax.into_repr())), | ||
3641 | _ => None, | ||
3642 | } | ||
3643 | } | ||
3644 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3645 | } | ||
3646 | |||
3647 | impl ToOwned for SelfKw { | ||
3648 | type Owned = TreeArc<SelfKw>; | ||
3649 | fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
3650 | } | ||
3651 | |||
3652 | |||
3653 | impl SelfKw {} | ||
3654 | |||
3655 | // SelfParam | 3216 | // SelfParam |
3656 | #[derive(Debug, PartialEq, Eq, Hash)] | 3217 | #[derive(Debug, PartialEq, Eq, Hash)] |
3657 | #[repr(transparent)] | 3218 | #[repr(transparent)] |
@@ -3679,11 +3240,7 @@ impl ToOwned for SelfParam { | |||
3679 | 3240 | ||
3680 | 3241 | ||
3681 | impl ast::TypeAscriptionOwner for SelfParam {} | 3242 | impl ast::TypeAscriptionOwner for SelfParam {} |
3682 | impl SelfParam { | 3243 | impl SelfParam {} |
3683 | pub fn self_kw(&self) -> Option<&SelfKw> { | ||
3684 | super::child_opt(self) | ||
3685 | } | ||
3686 | } | ||
3687 | 3244 | ||
3688 | // SlicePat | 3245 | // SlicePat |
3689 | #[derive(Debug, PartialEq, Eq, Hash)] | 3246 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3872,35 +3429,6 @@ impl Stmt { | |||
3872 | 3429 | ||
3873 | impl Stmt {} | 3430 | impl Stmt {} |
3874 | 3431 | ||
3875 | // String | ||
3876 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3877 | #[repr(transparent)] | ||
3878 | pub struct String { | ||
3879 | pub(crate) syntax: SyntaxNode, | ||
3880 | } | ||
3881 | unsafe impl TransparentNewType for String { | ||
3882 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3883 | } | ||
3884 | |||
3885 | impl AstNode for String { | ||
3886 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3887 | match syntax.kind() { | ||
3888 | STRING => Some(String::from_repr(syntax.into_repr())), | ||
3889 | _ => None, | ||
3890 | } | ||
3891 | } | ||
3892 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3893 | } | ||
3894 | |||
3895 | impl ToOwned for String { | ||
3896 | type Owned = TreeArc<String>; | ||
3897 | fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) } | ||
3898 | } | ||
3899 | |||
3900 | |||
3901 | impl ast::AstToken for String {} | ||
3902 | impl String {} | ||
3903 | |||
3904 | // StructDef | 3432 | // StructDef |
3905 | #[derive(Debug, PartialEq, Eq, Hash)] | 3433 | #[derive(Debug, PartialEq, Eq, Hash)] |
3906 | #[repr(transparent)] | 3434 | #[repr(transparent)] |
@@ -4069,41 +3597,13 @@ impl ast::NameOwner for TraitDef {} | |||
4069 | impl ast::AttrsOwner for TraitDef {} | 3597 | impl ast::AttrsOwner for TraitDef {} |
4070 | impl ast::DocCommentsOwner for TraitDef {} | 3598 | impl ast::DocCommentsOwner for TraitDef {} |
4071 | impl ast::TypeParamsOwner for TraitDef {} | 3599 | impl ast::TypeParamsOwner for TraitDef {} |
3600 | impl ast::TypeBoundsOwner for TraitDef {} | ||
4072 | impl TraitDef { | 3601 | impl TraitDef { |
4073 | pub fn item_list(&self) -> Option<&ItemList> { | 3602 | pub fn item_list(&self) -> Option<&ItemList> { |
4074 | super::child_opt(self) | 3603 | super::child_opt(self) |
4075 | } | 3604 | } |
4076 | } | 3605 | } |
4077 | 3606 | ||
4078 | // TrueKw | ||
4079 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
4080 | #[repr(transparent)] | ||
4081 | pub struct TrueKw { | ||
4082 | pub(crate) syntax: SyntaxNode, | ||
4083 | } | ||
4084 | unsafe impl TransparentNewType for TrueKw { | ||
4085 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
4086 | } | ||
4087 | |||
4088 | impl AstNode for TrueKw { | ||
4089 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
4090 | match syntax.kind() { | ||
4091 | TRUE_KW => Some(TrueKw::from_repr(syntax.into_repr())), | ||
4092 | _ => None, | ||
4093 | } | ||
4094 | } | ||
4095 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4096 | } | ||
4097 | |||
4098 | impl ToOwned for TrueKw { | ||
4099 | type Owned = TreeArc<TrueKw>; | ||
4100 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
4101 | } | ||
4102 | |||
4103 | |||
4104 | impl ast::AstToken for TrueKw {} | ||
4105 | impl TrueKw {} | ||
4106 | |||
4107 | // TryExpr | 3607 | // TryExpr |
4108 | #[derive(Debug, PartialEq, Eq, Hash)] | 3608 | #[derive(Debug, PartialEq, Eq, Hash)] |
4109 | #[repr(transparent)] | 3609 | #[repr(transparent)] |
@@ -4299,6 +3799,7 @@ impl ast::NameOwner for TypeAliasDef {} | |||
4299 | impl ast::TypeParamsOwner for TypeAliasDef {} | 3799 | impl ast::TypeParamsOwner for TypeAliasDef {} |
4300 | impl ast::AttrsOwner for TypeAliasDef {} | 3800 | impl ast::AttrsOwner for TypeAliasDef {} |
4301 | impl ast::DocCommentsOwner for TypeAliasDef {} | 3801 | impl ast::DocCommentsOwner for TypeAliasDef {} |
3802 | impl ast::TypeBoundsOwner for TypeAliasDef {} | ||
4302 | impl TypeAliasDef { | 3803 | impl TypeAliasDef { |
4303 | pub fn type_ref(&self) -> Option<&TypeRef> { | 3804 | pub fn type_ref(&self) -> Option<&TypeRef> { |
4304 | super::child_opt(self) | 3805 | super::child_opt(self) |
@@ -4377,6 +3878,70 @@ impl TypeArgList { | |||
4377 | } | 3878 | } |
4378 | } | 3879 | } |
4379 | 3880 | ||
3881 | // TypeBound | ||
3882 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3883 | #[repr(transparent)] | ||
3884 | pub struct TypeBound { | ||
3885 | pub(crate) syntax: SyntaxNode, | ||
3886 | } | ||
3887 | unsafe impl TransparentNewType for TypeBound { | ||
3888 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3889 | } | ||
3890 | |||
3891 | impl AstNode for TypeBound { | ||
3892 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3893 | match syntax.kind() { | ||
3894 | TYPE_BOUND => Some(TypeBound::from_repr(syntax.into_repr())), | ||
3895 | _ => None, | ||
3896 | } | ||
3897 | } | ||
3898 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3899 | } | ||
3900 | |||
3901 | impl ToOwned for TypeBound { | ||
3902 | type Owned = TreeArc<TypeBound>; | ||
3903 | fn to_owned(&self) -> TreeArc<TypeBound> { TreeArc::cast(self.syntax.to_owned()) } | ||
3904 | } | ||
3905 | |||
3906 | |||
3907 | impl TypeBound { | ||
3908 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
3909 | super::child_opt(self) | ||
3910 | } | ||
3911 | } | ||
3912 | |||
3913 | // TypeBoundList | ||
3914 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3915 | #[repr(transparent)] | ||
3916 | pub struct TypeBoundList { | ||
3917 | pub(crate) syntax: SyntaxNode, | ||
3918 | } | ||
3919 | unsafe impl TransparentNewType for TypeBoundList { | ||
3920 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3921 | } | ||
3922 | |||
3923 | impl AstNode for TypeBoundList { | ||
3924 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3925 | match syntax.kind() { | ||
3926 | TYPE_BOUND_LIST => Some(TypeBoundList::from_repr(syntax.into_repr())), | ||
3927 | _ => None, | ||
3928 | } | ||
3929 | } | ||
3930 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3931 | } | ||
3932 | |||
3933 | impl ToOwned for TypeBoundList { | ||
3934 | type Owned = TreeArc<TypeBoundList>; | ||
3935 | fn to_owned(&self) -> TreeArc<TypeBoundList> { TreeArc::cast(self.syntax.to_owned()) } | ||
3936 | } | ||
3937 | |||
3938 | |||
3939 | impl TypeBoundList { | ||
3940 | pub fn bounds(&self) -> impl Iterator<Item = &TypeBound> { | ||
3941 | super::children(self) | ||
3942 | } | ||
3943 | } | ||
3944 | |||
4380 | // TypeParam | 3945 | // TypeParam |
4381 | #[derive(Debug, PartialEq, Eq, Hash)] | 3946 | #[derive(Debug, PartialEq, Eq, Hash)] |
4382 | #[repr(transparent)] | 3947 | #[repr(transparent)] |
@@ -4405,6 +3970,7 @@ impl ToOwned for TypeParam { | |||
4405 | 3970 | ||
4406 | impl ast::NameOwner for TypeParam {} | 3971 | impl ast::NameOwner for TypeParam {} |
4407 | impl ast::AttrsOwner for TypeParam {} | 3972 | impl ast::AttrsOwner for TypeParam {} |
3973 | impl ast::TypeBoundsOwner for TypeParam {} | ||
4408 | impl TypeParam {} | 3974 | impl TypeParam {} |
4409 | 3975 | ||
4410 | // TypeParamList | 3976 | // TypeParamList |
@@ -4745,67 +4311,75 @@ impl ToOwned for WhereClause { | |||
4745 | } | 4311 | } |
4746 | 4312 | ||
4747 | 4313 | ||
4748 | impl WhereClause {} | 4314 | impl WhereClause { |
4315 | pub fn predicates(&self) -> impl Iterator<Item = &WherePred> { | ||
4316 | super::children(self) | ||
4317 | } | ||
4318 | } | ||
4749 | 4319 | ||
4750 | // WhileExpr | 4320 | // WherePred |
4751 | #[derive(Debug, PartialEq, Eq, Hash)] | 4321 | #[derive(Debug, PartialEq, Eq, Hash)] |
4752 | #[repr(transparent)] | 4322 | #[repr(transparent)] |
4753 | pub struct WhileExpr { | 4323 | pub struct WherePred { |
4754 | pub(crate) syntax: SyntaxNode, | 4324 | pub(crate) syntax: SyntaxNode, |
4755 | } | 4325 | } |
4756 | unsafe impl TransparentNewType for WhileExpr { | 4326 | unsafe impl TransparentNewType for WherePred { |
4757 | type Repr = rowan::SyntaxNode<RaTypes>; | 4327 | type Repr = rowan::SyntaxNode<RaTypes>; |
4758 | } | 4328 | } |
4759 | 4329 | ||
4760 | impl AstNode for WhileExpr { | 4330 | impl AstNode for WherePred { |
4761 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | 4331 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { |
4762 | match syntax.kind() { | 4332 | match syntax.kind() { |
4763 | WHILE_EXPR => Some(WhileExpr::from_repr(syntax.into_repr())), | 4333 | WHERE_PRED => Some(WherePred::from_repr(syntax.into_repr())), |
4764 | _ => None, | 4334 | _ => None, |
4765 | } | 4335 | } |
4766 | } | 4336 | } |
4767 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4337 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4768 | } | 4338 | } |
4769 | 4339 | ||
4770 | impl ToOwned for WhileExpr { | 4340 | impl ToOwned for WherePred { |
4771 | type Owned = TreeArc<WhileExpr>; | 4341 | type Owned = TreeArc<WherePred>; |
4772 | fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) } | 4342 | fn to_owned(&self) -> TreeArc<WherePred> { TreeArc::cast(self.syntax.to_owned()) } |
4773 | } | 4343 | } |
4774 | 4344 | ||
4775 | 4345 | ||
4776 | impl ast::LoopBodyOwner for WhileExpr {} | 4346 | impl ast::TypeBoundsOwner for WherePred {} |
4777 | impl WhileExpr { | 4347 | impl WherePred { |
4778 | pub fn condition(&self) -> Option<&Condition> { | 4348 | pub fn type_ref(&self) -> Option<&TypeRef> { |
4779 | super::child_opt(self) | 4349 | super::child_opt(self) |
4780 | } | 4350 | } |
4781 | } | 4351 | } |
4782 | 4352 | ||
4783 | // Whitespace | 4353 | // WhileExpr |
4784 | #[derive(Debug, PartialEq, Eq, Hash)] | 4354 | #[derive(Debug, PartialEq, Eq, Hash)] |
4785 | #[repr(transparent)] | 4355 | #[repr(transparent)] |
4786 | pub struct Whitespace { | 4356 | pub struct WhileExpr { |
4787 | pub(crate) syntax: SyntaxNode, | 4357 | pub(crate) syntax: SyntaxNode, |
4788 | } | 4358 | } |
4789 | unsafe impl TransparentNewType for Whitespace { | 4359 | unsafe impl TransparentNewType for WhileExpr { |
4790 | type Repr = rowan::SyntaxNode<RaTypes>; | 4360 | type Repr = rowan::SyntaxNode<RaTypes>; |
4791 | } | 4361 | } |
4792 | 4362 | ||
4793 | impl AstNode for Whitespace { | 4363 | impl AstNode for WhileExpr { |
4794 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | 4364 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { |
4795 | match syntax.kind() { | 4365 | match syntax.kind() { |
4796 | WHITESPACE => Some(Whitespace::from_repr(syntax.into_repr())), | 4366 | WHILE_EXPR => Some(WhileExpr::from_repr(syntax.into_repr())), |
4797 | _ => None, | 4367 | _ => None, |
4798 | } | 4368 | } |
4799 | } | 4369 | } |
4800 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 4370 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
4801 | } | 4371 | } |
4802 | 4372 | ||
4803 | impl ToOwned for Whitespace { | 4373 | impl ToOwned for WhileExpr { |
4804 | type Owned = TreeArc<Whitespace>; | 4374 | type Owned = TreeArc<WhileExpr>; |
4805 | fn to_owned(&self) -> TreeArc<Whitespace> { TreeArc::cast(self.syntax.to_owned()) } | 4375 | fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) } |
4806 | } | 4376 | } |
4807 | 4377 | ||
4808 | 4378 | ||
4809 | impl ast::AstToken for Whitespace {} | 4379 | impl ast::LoopBodyOwner for WhileExpr {} |
4810 | impl Whitespace {} | 4380 | impl WhileExpr { |
4381 | pub fn condition(&self) -> Option<&Condition> { | ||
4382 | super::child_opt(self) | ||
4383 | } | ||
4384 | } | ||
4811 | 4385 | ||