diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 627 |
1 files changed, 111 insertions, 516 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 47a37e4d1..4afe1a146 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)] |
@@ -685,6 +569,7 @@ impl ToOwned for DynTraitType { | |||
685 | } | 569 | } |
686 | 570 | ||
687 | 571 | ||
572 | impl ast::TypeBoundsOwner for DynTraitType {} | ||
688 | impl DynTraitType {} | 573 | impl DynTraitType {} |
689 | 574 | ||
690 | // EnumDef | 575 | // EnumDef |
@@ -1114,35 +999,6 @@ impl ExternCrateItem { | |||
1114 | } | 999 | } |
1115 | } | 1000 | } |
1116 | 1001 | ||
1117 | // FalseKw | ||
1118 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1119 | #[repr(transparent)] | ||
1120 | pub struct FalseKw { | ||
1121 | pub(crate) syntax: SyntaxNode, | ||
1122 | } | ||
1123 | unsafe impl TransparentNewType for FalseKw { | ||
1124 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1125 | } | ||
1126 | |||
1127 | impl AstNode for FalseKw { | ||
1128 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1129 | match syntax.kind() { | ||
1130 | FALSE_KW => Some(FalseKw::from_repr(syntax.into_repr())), | ||
1131 | _ => None, | ||
1132 | } | ||
1133 | } | ||
1134 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1135 | } | ||
1136 | |||
1137 | impl ToOwned for FalseKw { | ||
1138 | type Owned = TreeArc<FalseKw>; | ||
1139 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
1140 | } | ||
1141 | |||
1142 | |||
1143 | impl ast::AstToken for FalseKw {} | ||
1144 | impl FalseKw {} | ||
1145 | |||
1146 | // FieldExpr | 1002 | // FieldExpr |
1147 | #[derive(Debug, PartialEq, Eq, Hash)] | 1003 | #[derive(Debug, PartialEq, Eq, Hash)] |
1148 | #[repr(transparent)] | 1004 | #[repr(transparent)] |
@@ -1248,35 +1104,6 @@ impl FieldPatList { | |||
1248 | } | 1104 | } |
1249 | } | 1105 | } |
1250 | 1106 | ||
1251 | // FloatNumber | ||
1252 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1253 | #[repr(transparent)] | ||
1254 | pub struct FloatNumber { | ||
1255 | pub(crate) syntax: SyntaxNode, | ||
1256 | } | ||
1257 | unsafe impl TransparentNewType for FloatNumber { | ||
1258 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1259 | } | ||
1260 | |||
1261 | impl AstNode for FloatNumber { | ||
1262 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1263 | match syntax.kind() { | ||
1264 | FLOAT_NUMBER => Some(FloatNumber::from_repr(syntax.into_repr())), | ||
1265 | _ => None, | ||
1266 | } | ||
1267 | } | ||
1268 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1269 | } | ||
1270 | |||
1271 | impl ToOwned for FloatNumber { | ||
1272 | type Owned = TreeArc<FloatNumber>; | ||
1273 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1274 | } | ||
1275 | |||
1276 | |||
1277 | impl ast::AstToken for FloatNumber {} | ||
1278 | impl FloatNumber {} | ||
1279 | |||
1280 | // FnDef | 1107 | // FnDef |
1281 | #[derive(Debug, PartialEq, Eq, Hash)] | 1108 | #[derive(Debug, PartialEq, Eq, Hash)] |
1282 | #[repr(transparent)] | 1109 | #[repr(transparent)] |
@@ -1581,6 +1408,7 @@ impl ToOwned for ImplTraitType { | |||
1581 | } | 1408 | } |
1582 | 1409 | ||
1583 | 1410 | ||
1411 | impl ast::TypeBoundsOwner for ImplTraitType {} | ||
1584 | impl ImplTraitType {} | 1412 | impl ImplTraitType {} |
1585 | 1413 | ||
1586 | // IndexExpr | 1414 | // IndexExpr |
@@ -1611,35 +1439,6 @@ impl ToOwned for IndexExpr { | |||
1611 | 1439 | ||
1612 | impl IndexExpr {} | 1440 | impl IndexExpr {} |
1613 | 1441 | ||
1614 | // IntNumber | ||
1615 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1616 | #[repr(transparent)] | ||
1617 | pub struct IntNumber { | ||
1618 | pub(crate) syntax: SyntaxNode, | ||
1619 | } | ||
1620 | unsafe impl TransparentNewType for IntNumber { | ||
1621 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1622 | } | ||
1623 | |||
1624 | impl AstNode for IntNumber { | ||
1625 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1626 | match syntax.kind() { | ||
1627 | INT_NUMBER => Some(IntNumber::from_repr(syntax.into_repr())), | ||
1628 | _ => None, | ||
1629 | } | ||
1630 | } | ||
1631 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1632 | } | ||
1633 | |||
1634 | impl ToOwned for IntNumber { | ||
1635 | type Owned = TreeArc<IntNumber>; | ||
1636 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1637 | } | ||
1638 | |||
1639 | |||
1640 | impl ast::AstToken for IntNumber {} | ||
1641 | impl IntNumber {} | ||
1642 | |||
1643 | // ItemList | 1442 | // ItemList |
1644 | #[derive(Debug, PartialEq, Eq, Hash)] | 1443 | #[derive(Debug, PartialEq, Eq, Hash)] |
1645 | #[repr(transparent)] | 1444 | #[repr(transparent)] |
@@ -1775,35 +1574,6 @@ impl LetStmt { | |||
1775 | } | 1574 | } |
1776 | } | 1575 | } |
1777 | 1576 | ||
1778 | // Lifetime | ||
1779 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1780 | #[repr(transparent)] | ||
1781 | pub struct Lifetime { | ||
1782 | pub(crate) syntax: SyntaxNode, | ||
1783 | } | ||
1784 | unsafe impl TransparentNewType for Lifetime { | ||
1785 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1786 | } | ||
1787 | |||
1788 | impl AstNode for Lifetime { | ||
1789 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1790 | match syntax.kind() { | ||
1791 | LIFETIME => Some(Lifetime::from_repr(syntax.into_repr())), | ||
1792 | _ => None, | ||
1793 | } | ||
1794 | } | ||
1795 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1796 | } | ||
1797 | |||
1798 | impl ToOwned for Lifetime { | ||
1799 | type Owned = TreeArc<Lifetime>; | ||
1800 | fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) } | ||
1801 | } | ||
1802 | |||
1803 | |||
1804 | impl ast::AstToken for Lifetime {} | ||
1805 | impl Lifetime {} | ||
1806 | |||
1807 | // LifetimeArg | 1577 | // LifetimeArg |
1808 | #[derive(Debug, PartialEq, Eq, Hash)] | 1578 | #[derive(Debug, PartialEq, Eq, Hash)] |
1809 | #[repr(transparent)] | 1579 | #[repr(transparent)] |
@@ -1830,11 +1600,7 @@ impl ToOwned for LifetimeArg { | |||
1830 | } | 1600 | } |
1831 | 1601 | ||
1832 | 1602 | ||
1833 | impl LifetimeArg { | 1603 | impl LifetimeArg {} |
1834 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1835 | super::child_opt(self) | ||
1836 | } | ||
1837 | } | ||
1838 | 1604 | ||
1839 | // LifetimeParam | 1605 | // LifetimeParam |
1840 | #[derive(Debug, PartialEq, Eq, Hash)] | 1606 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1863,11 +1629,7 @@ impl ToOwned for LifetimeParam { | |||
1863 | 1629 | ||
1864 | 1630 | ||
1865 | impl ast::AttrsOwner for LifetimeParam {} | 1631 | impl ast::AttrsOwner for LifetimeParam {} |
1866 | impl LifetimeParam { | 1632 | impl LifetimeParam {} |
1867 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1868 | super::child_opt(self) | ||
1869 | } | ||
1870 | } | ||
1871 | 1633 | ||
1872 | // Literal | 1634 | // Literal |
1873 | #[derive(Debug, PartialEq, Eq, Hash)] | 1635 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1895,130 +1657,7 @@ impl ToOwned for Literal { | |||
1895 | } | 1657 | } |
1896 | 1658 | ||
1897 | 1659 | ||
1898 | impl Literal { | 1660 | impl Literal {} |
1899 | pub fn literal_expr(&self) -> Option<&LiteralExpr> { | ||
1900 | super::child_opt(self) | ||
1901 | } | ||
1902 | } | ||
1903 | |||
1904 | // LiteralExpr | ||
1905 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1906 | #[repr(transparent)] | ||
1907 | pub struct LiteralExpr { | ||
1908 | pub(crate) syntax: SyntaxNode, | ||
1909 | } | ||
1910 | unsafe impl TransparentNewType for LiteralExpr { | ||
1911 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1912 | } | ||
1913 | |||
1914 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
1915 | pub enum LiteralExprKind<'a> { | ||
1916 | String(&'a String), | ||
1917 | ByteString(&'a ByteString), | ||
1918 | RawString(&'a RawString), | ||
1919 | RawByteString(&'a RawByteString), | ||
1920 | Char(&'a Char), | ||
1921 | Byte(&'a Byte), | ||
1922 | IntNumber(&'a IntNumber), | ||
1923 | FloatNumber(&'a FloatNumber), | ||
1924 | TrueKw(&'a TrueKw), | ||
1925 | FalseKw(&'a FalseKw), | ||
1926 | } | ||
1927 | impl<'a> From<&'a String> for &'a LiteralExpr { | ||
1928 | fn from(n: &'a String) -> &'a LiteralExpr { | ||
1929 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1930 | } | ||
1931 | } | ||
1932 | impl<'a> From<&'a ByteString> for &'a LiteralExpr { | ||
1933 | fn from(n: &'a ByteString) -> &'a LiteralExpr { | ||
1934 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1935 | } | ||
1936 | } | ||
1937 | impl<'a> From<&'a RawString> for &'a LiteralExpr { | ||
1938 | fn from(n: &'a RawString) -> &'a LiteralExpr { | ||
1939 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1940 | } | ||
1941 | } | ||
1942 | impl<'a> From<&'a RawByteString> for &'a LiteralExpr { | ||
1943 | fn from(n: &'a RawByteString) -> &'a LiteralExpr { | ||
1944 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1945 | } | ||
1946 | } | ||
1947 | impl<'a> From<&'a Char> for &'a LiteralExpr { | ||
1948 | fn from(n: &'a Char) -> &'a LiteralExpr { | ||
1949 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1950 | } | ||
1951 | } | ||
1952 | impl<'a> From<&'a Byte> for &'a LiteralExpr { | ||
1953 | fn from(n: &'a Byte) -> &'a LiteralExpr { | ||
1954 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1955 | } | ||
1956 | } | ||
1957 | impl<'a> From<&'a IntNumber> for &'a LiteralExpr { | ||
1958 | fn from(n: &'a IntNumber) -> &'a LiteralExpr { | ||
1959 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1960 | } | ||
1961 | } | ||
1962 | impl<'a> From<&'a FloatNumber> for &'a LiteralExpr { | ||
1963 | fn from(n: &'a FloatNumber) -> &'a LiteralExpr { | ||
1964 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1965 | } | ||
1966 | } | ||
1967 | impl<'a> From<&'a TrueKw> for &'a LiteralExpr { | ||
1968 | fn from(n: &'a TrueKw) -> &'a LiteralExpr { | ||
1969 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1970 | } | ||
1971 | } | ||
1972 | impl<'a> From<&'a FalseKw> for &'a LiteralExpr { | ||
1973 | fn from(n: &'a FalseKw) -> &'a LiteralExpr { | ||
1974 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1975 | } | ||
1976 | } | ||
1977 | |||
1978 | |||
1979 | impl AstNode for LiteralExpr { | ||
1980 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1981 | match syntax.kind() { | ||
1982 | | STRING | ||
1983 | | BYTE_STRING | ||
1984 | | RAW_STRING | ||
1985 | | RAW_BYTE_STRING | ||
1986 | | CHAR | ||
1987 | | BYTE | ||
1988 | | INT_NUMBER | ||
1989 | | FLOAT_NUMBER | ||
1990 | | TRUE_KW | ||
1991 | | FALSE_KW => Some(LiteralExpr::from_repr(syntax.into_repr())), | ||
1992 | _ => None, | ||
1993 | } | ||
1994 | } | ||
1995 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1996 | } | ||
1997 | |||
1998 | impl ToOwned for LiteralExpr { | ||
1999 | type Owned = TreeArc<LiteralExpr>; | ||
2000 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } | ||
2001 | } | ||
2002 | |||
2003 | impl LiteralExpr { | ||
2004 | pub fn kind(&self) -> LiteralExprKind { | ||
2005 | match self.syntax.kind() { | ||
2006 | STRING => LiteralExprKind::String(String::cast(&self.syntax).unwrap()), | ||
2007 | BYTE_STRING => LiteralExprKind::ByteString(ByteString::cast(&self.syntax).unwrap()), | ||
2008 | RAW_STRING => LiteralExprKind::RawString(RawString::cast(&self.syntax).unwrap()), | ||
2009 | RAW_BYTE_STRING => LiteralExprKind::RawByteString(RawByteString::cast(&self.syntax).unwrap()), | ||
2010 | CHAR => LiteralExprKind::Char(Char::cast(&self.syntax).unwrap()), | ||
2011 | BYTE => LiteralExprKind::Byte(Byte::cast(&self.syntax).unwrap()), | ||
2012 | INT_NUMBER => LiteralExprKind::IntNumber(IntNumber::cast(&self.syntax).unwrap()), | ||
2013 | FLOAT_NUMBER => LiteralExprKind::FloatNumber(FloatNumber::cast(&self.syntax).unwrap()), | ||
2014 | TRUE_KW => LiteralExprKind::TrueKw(TrueKw::cast(&self.syntax).unwrap()), | ||
2015 | FALSE_KW => LiteralExprKind::FalseKw(FalseKw::cast(&self.syntax).unwrap()), | ||
2016 | _ => unreachable!(), | ||
2017 | } | ||
2018 | } | ||
2019 | } | ||
2020 | |||
2021 | impl LiteralExpr {} | ||
2022 | 1661 | ||
2023 | // LiteralPat | 1662 | // LiteralPat |
2024 | #[derive(Debug, PartialEq, Eq, Hash)] | 1663 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3402,64 +3041,6 @@ impl ToOwned for RangePat { | |||
3402 | 3041 | ||
3403 | impl RangePat {} | 3042 | impl RangePat {} |
3404 | 3043 | ||
3405 | // RawByteString | ||
3406 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3407 | #[repr(transparent)] | ||
3408 | pub struct RawByteString { | ||
3409 | pub(crate) syntax: SyntaxNode, | ||
3410 | } | ||
3411 | unsafe impl TransparentNewType for RawByteString { | ||
3412 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3413 | } | ||
3414 | |||
3415 | impl AstNode for RawByteString { | ||
3416 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3417 | match syntax.kind() { | ||
3418 | RAW_BYTE_STRING => Some(RawByteString::from_repr(syntax.into_repr())), | ||
3419 | _ => None, | ||
3420 | } | ||
3421 | } | ||
3422 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3423 | } | ||
3424 | |||
3425 | impl ToOwned for RawByteString { | ||
3426 | type Owned = TreeArc<RawByteString>; | ||
3427 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3428 | } | ||
3429 | |||
3430 | |||
3431 | impl ast::AstToken for RawByteString {} | ||
3432 | impl RawByteString {} | ||
3433 | |||
3434 | // RawString | ||
3435 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3436 | #[repr(transparent)] | ||
3437 | pub struct RawString { | ||
3438 | pub(crate) syntax: SyntaxNode, | ||
3439 | } | ||
3440 | unsafe impl TransparentNewType for RawString { | ||
3441 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3442 | } | ||
3443 | |||
3444 | impl AstNode for RawString { | ||
3445 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3446 | match syntax.kind() { | ||
3447 | RAW_STRING => Some(RawString::from_repr(syntax.into_repr())), | ||
3448 | _ => None, | ||
3449 | } | ||
3450 | } | ||
3451 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3452 | } | ||
3453 | |||
3454 | impl ToOwned for RawString { | ||
3455 | type Owned = TreeArc<RawString>; | ||
3456 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3457 | } | ||
3458 | |||
3459 | |||
3460 | impl ast::AstToken for RawString {} | ||
3461 | impl RawString {} | ||
3462 | |||
3463 | // RefExpr | 3044 | // RefExpr |
3464 | #[derive(Debug, PartialEq, Eq, Hash)] | 3045 | #[derive(Debug, PartialEq, Eq, Hash)] |
3465 | #[repr(transparent)] | 3046 | #[repr(transparent)] |
@@ -3620,34 +3201,6 @@ impl ReturnExpr { | |||
3620 | } | 3201 | } |
3621 | } | 3202 | } |
3622 | 3203 | ||
3623 | // SelfKw | ||
3624 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3625 | #[repr(transparent)] | ||
3626 | pub struct SelfKw { | ||
3627 | pub(crate) syntax: SyntaxNode, | ||
3628 | } | ||
3629 | unsafe impl TransparentNewType for SelfKw { | ||
3630 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3631 | } | ||
3632 | |||
3633 | impl AstNode for SelfKw { | ||
3634 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3635 | match syntax.kind() { | ||
3636 | SELF_KW => Some(SelfKw::from_repr(syntax.into_repr())), | ||
3637 | _ => None, | ||
3638 | } | ||
3639 | } | ||
3640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3641 | } | ||
3642 | |||
3643 | impl ToOwned for SelfKw { | ||
3644 | type Owned = TreeArc<SelfKw>; | ||
3645 | fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
3646 | } | ||
3647 | |||
3648 | |||
3649 | impl SelfKw {} | ||
3650 | |||
3651 | // SelfParam | 3204 | // SelfParam |
3652 | #[derive(Debug, PartialEq, Eq, Hash)] | 3205 | #[derive(Debug, PartialEq, Eq, Hash)] |
3653 | #[repr(transparent)] | 3206 | #[repr(transparent)] |
@@ -3675,11 +3228,7 @@ impl ToOwned for SelfParam { | |||
3675 | 3228 | ||
3676 | 3229 | ||
3677 | impl ast::TypeAscriptionOwner for SelfParam {} | 3230 | impl ast::TypeAscriptionOwner for SelfParam {} |
3678 | impl SelfParam { | 3231 | impl SelfParam {} |
3679 | pub fn self_kw(&self) -> Option<&SelfKw> { | ||
3680 | super::child_opt(self) | ||
3681 | } | ||
3682 | } | ||
3683 | 3232 | ||
3684 | // SlicePat | 3233 | // SlicePat |
3685 | #[derive(Debug, PartialEq, Eq, Hash)] | 3234 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3864,35 +3413,6 @@ impl Stmt { | |||
3864 | 3413 | ||
3865 | impl Stmt {} | 3414 | impl Stmt {} |
3866 | 3415 | ||
3867 | // String | ||
3868 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3869 | #[repr(transparent)] | ||
3870 | pub struct String { | ||
3871 | pub(crate) syntax: SyntaxNode, | ||
3872 | } | ||
3873 | unsafe impl TransparentNewType for String { | ||
3874 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3875 | } | ||
3876 | |||
3877 | impl AstNode for String { | ||
3878 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3879 | match syntax.kind() { | ||
3880 | STRING => Some(String::from_repr(syntax.into_repr())), | ||
3881 | _ => None, | ||
3882 | } | ||
3883 | } | ||
3884 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3885 | } | ||
3886 | |||
3887 | impl ToOwned for String { | ||
3888 | type Owned = TreeArc<String>; | ||
3889 | fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) } | ||
3890 | } | ||
3891 | |||
3892 | |||
3893 | impl ast::AstToken for String {} | ||
3894 | impl String {} | ||
3895 | |||
3896 | // StructDef | 3416 | // StructDef |
3897 | #[derive(Debug, PartialEq, Eq, Hash)] | 3417 | #[derive(Debug, PartialEq, Eq, Hash)] |
3898 | #[repr(transparent)] | 3418 | #[repr(transparent)] |
@@ -4061,41 +3581,13 @@ impl ast::NameOwner for TraitDef {} | |||
4061 | impl ast::AttrsOwner for TraitDef {} | 3581 | impl ast::AttrsOwner for TraitDef {} |
4062 | impl ast::DocCommentsOwner for TraitDef {} | 3582 | impl ast::DocCommentsOwner for TraitDef {} |
4063 | impl ast::TypeParamsOwner for TraitDef {} | 3583 | impl ast::TypeParamsOwner for TraitDef {} |
3584 | impl ast::TypeBoundsOwner for TraitDef {} | ||
4064 | impl TraitDef { | 3585 | impl TraitDef { |
4065 | pub fn item_list(&self) -> Option<&ItemList> { | 3586 | pub fn item_list(&self) -> Option<&ItemList> { |
4066 | super::child_opt(self) | 3587 | super::child_opt(self) |
4067 | } | 3588 | } |
4068 | } | 3589 | } |
4069 | 3590 | ||
4070 | // TrueKw | ||
4071 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
4072 | #[repr(transparent)] | ||
4073 | pub struct TrueKw { | ||
4074 | pub(crate) syntax: SyntaxNode, | ||
4075 | } | ||
4076 | unsafe impl TransparentNewType for TrueKw { | ||
4077 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
4078 | } | ||
4079 | |||
4080 | impl AstNode for TrueKw { | ||
4081 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
4082 | match syntax.kind() { | ||
4083 | TRUE_KW => Some(TrueKw::from_repr(syntax.into_repr())), | ||
4084 | _ => None, | ||
4085 | } | ||
4086 | } | ||
4087 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4088 | } | ||
4089 | |||
4090 | impl ToOwned for TrueKw { | ||
4091 | type Owned = TreeArc<TrueKw>; | ||
4092 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
4093 | } | ||
4094 | |||
4095 | |||
4096 | impl ast::AstToken for TrueKw {} | ||
4097 | impl TrueKw {} | ||
4098 | |||
4099 | // TryExpr | 3591 | // TryExpr |
4100 | #[derive(Debug, PartialEq, Eq, Hash)] | 3592 | #[derive(Debug, PartialEq, Eq, Hash)] |
4101 | #[repr(transparent)] | 3593 | #[repr(transparent)] |
@@ -4291,6 +3783,7 @@ impl ast::NameOwner for TypeAliasDef {} | |||
4291 | impl ast::TypeParamsOwner for TypeAliasDef {} | 3783 | impl ast::TypeParamsOwner for TypeAliasDef {} |
4292 | impl ast::AttrsOwner for TypeAliasDef {} | 3784 | impl ast::AttrsOwner for TypeAliasDef {} |
4293 | impl ast::DocCommentsOwner for TypeAliasDef {} | 3785 | impl ast::DocCommentsOwner for TypeAliasDef {} |
3786 | impl ast::TypeBoundsOwner for TypeAliasDef {} | ||
4294 | impl TypeAliasDef { | 3787 | impl TypeAliasDef { |
4295 | pub fn type_ref(&self) -> Option<&TypeRef> { | 3788 | pub fn type_ref(&self) -> Option<&TypeRef> { |
4296 | super::child_opt(self) | 3789 | super::child_opt(self) |
@@ -4369,6 +3862,70 @@ impl TypeArgList { | |||
4369 | } | 3862 | } |
4370 | } | 3863 | } |
4371 | 3864 | ||
3865 | // TypeBound | ||
3866 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3867 | #[repr(transparent)] | ||
3868 | pub struct TypeBound { | ||
3869 | pub(crate) syntax: SyntaxNode, | ||
3870 | } | ||
3871 | unsafe impl TransparentNewType for TypeBound { | ||
3872 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3873 | } | ||
3874 | |||
3875 | impl AstNode for TypeBound { | ||
3876 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3877 | match syntax.kind() { | ||
3878 | TYPE_BOUND => Some(TypeBound::from_repr(syntax.into_repr())), | ||
3879 | _ => None, | ||
3880 | } | ||
3881 | } | ||
3882 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3883 | } | ||
3884 | |||
3885 | impl ToOwned for TypeBound { | ||
3886 | type Owned = TreeArc<TypeBound>; | ||
3887 | fn to_owned(&self) -> TreeArc<TypeBound> { TreeArc::cast(self.syntax.to_owned()) } | ||
3888 | } | ||
3889 | |||
3890 | |||
3891 | impl TypeBound { | ||
3892 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
3893 | super::child_opt(self) | ||
3894 | } | ||
3895 | } | ||
3896 | |||
3897 | // TypeBoundList | ||
3898 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3899 | #[repr(transparent)] | ||
3900 | pub struct TypeBoundList { | ||
3901 | pub(crate) syntax: SyntaxNode, | ||
3902 | } | ||
3903 | unsafe impl TransparentNewType for TypeBoundList { | ||
3904 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3905 | } | ||
3906 | |||
3907 | impl AstNode for TypeBoundList { | ||
3908 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3909 | match syntax.kind() { | ||
3910 | TYPE_BOUND_LIST => Some(TypeBoundList::from_repr(syntax.into_repr())), | ||
3911 | _ => None, | ||
3912 | } | ||
3913 | } | ||
3914 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3915 | } | ||
3916 | |||
3917 | impl ToOwned for TypeBoundList { | ||
3918 | type Owned = TreeArc<TypeBoundList>; | ||
3919 | fn to_owned(&self) -> TreeArc<TypeBoundList> { TreeArc::cast(self.syntax.to_owned()) } | ||
3920 | } | ||
3921 | |||
3922 | |||
3923 | impl TypeBoundList { | ||
3924 | pub fn bounds(&self) -> impl Iterator<Item = &TypeBound> { | ||
3925 | super::children(self) | ||
3926 | } | ||
3927 | } | ||
3928 | |||
4372 | // TypeParam | 3929 | // TypeParam |
4373 | #[derive(Debug, PartialEq, Eq, Hash)] | 3930 | #[derive(Debug, PartialEq, Eq, Hash)] |
4374 | #[repr(transparent)] | 3931 | #[repr(transparent)] |
@@ -4397,6 +3954,7 @@ impl ToOwned for TypeParam { | |||
4397 | 3954 | ||
4398 | impl ast::NameOwner for TypeParam {} | 3955 | impl ast::NameOwner for TypeParam {} |
4399 | impl ast::AttrsOwner for TypeParam {} | 3956 | impl ast::AttrsOwner for TypeParam {} |
3957 | impl ast::TypeBoundsOwner for TypeParam {} | ||
4400 | impl TypeParam {} | 3958 | impl TypeParam {} |
4401 | 3959 | ||
4402 | // TypeParamList | 3960 | // TypeParamList |
@@ -4737,7 +4295,44 @@ impl ToOwned for WhereClause { | |||
4737 | } | 4295 | } |
4738 | 4296 | ||
4739 | 4297 | ||
4740 | impl WhereClause {} | 4298 | impl WhereClause { |
4299 | pub fn predicates(&self) -> impl Iterator<Item = &WherePred> { | ||
4300 | super::children(self) | ||
4301 | } | ||
4302 | } | ||
4303 | |||
4304 | // WherePred | ||
4305 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
4306 | #[repr(transparent)] | ||
4307 | pub struct WherePred { | ||
4308 | pub(crate) syntax: SyntaxNode, | ||
4309 | } | ||
4310 | unsafe impl TransparentNewType for WherePred { | ||
4311 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
4312 | } | ||
4313 | |||
4314 | impl AstNode for WherePred { | ||
4315 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
4316 | match syntax.kind() { | ||
4317 | WHERE_PRED => Some(WherePred::from_repr(syntax.into_repr())), | ||
4318 | _ => None, | ||
4319 | } | ||
4320 | } | ||
4321 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4322 | } | ||
4323 | |||
4324 | impl ToOwned for WherePred { | ||
4325 | type Owned = TreeArc<WherePred>; | ||
4326 | fn to_owned(&self) -> TreeArc<WherePred> { TreeArc::cast(self.syntax.to_owned()) } | ||
4327 | } | ||
4328 | |||
4329 | |||
4330 | impl ast::TypeBoundsOwner for WherePred {} | ||
4331 | impl WherePred { | ||
4332 | pub fn type_ref(&self) -> Option<&TypeRef> { | ||
4333 | super::child_opt(self) | ||
4334 | } | ||
4335 | } | ||
4741 | 4336 | ||
4742 | // WhileExpr | 4337 | // WhileExpr |
4743 | #[derive(Debug, PartialEq, Eq, Hash)] | 4338 | #[derive(Debug, PartialEq, Eq, Hash)] |