diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-01 10:30:25 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-01 10:30:25 +0100 |
commit | 42a883f06c28ddeab22e5703a578f19110dde7f3 (patch) | |
tree | fe57697b54ccfb791fe96c13cb553a8570516270 /crates/ra_syntax/src/ast/generated.rs | |
parent | dec9bde10868b5e459535449476d17a6a0987b3e (diff) | |
parent | 9e213385c9d06db3c8ca20812779e2b8f8ad2c71 (diff) |
Merge #1078
1078: rewrite syntax trees r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 527 |
1 files changed, 4 insertions, 523 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index c51b4caa4..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)] |
@@ -1115,35 +999,6 @@ impl ExternCrateItem { | |||
1115 | } | 999 | } |
1116 | } | 1000 | } |
1117 | 1001 | ||
1118 | // FalseKw | ||
1119 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1120 | #[repr(transparent)] | ||
1121 | pub struct FalseKw { | ||
1122 | pub(crate) syntax: SyntaxNode, | ||
1123 | } | ||
1124 | unsafe impl TransparentNewType for FalseKw { | ||
1125 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1126 | } | ||
1127 | |||
1128 | impl AstNode for FalseKw { | ||
1129 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1130 | match syntax.kind() { | ||
1131 | FALSE_KW => Some(FalseKw::from_repr(syntax.into_repr())), | ||
1132 | _ => None, | ||
1133 | } | ||
1134 | } | ||
1135 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1136 | } | ||
1137 | |||
1138 | impl ToOwned for FalseKw { | ||
1139 | type Owned = TreeArc<FalseKw>; | ||
1140 | fn to_owned(&self) -> TreeArc<FalseKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
1141 | } | ||
1142 | |||
1143 | |||
1144 | impl ast::AstToken for FalseKw {} | ||
1145 | impl FalseKw {} | ||
1146 | |||
1147 | // FieldExpr | 1002 | // FieldExpr |
1148 | #[derive(Debug, PartialEq, Eq, Hash)] | 1003 | #[derive(Debug, PartialEq, Eq, Hash)] |
1149 | #[repr(transparent)] | 1004 | #[repr(transparent)] |
@@ -1249,35 +1104,6 @@ impl FieldPatList { | |||
1249 | } | 1104 | } |
1250 | } | 1105 | } |
1251 | 1106 | ||
1252 | // FloatNumber | ||
1253 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1254 | #[repr(transparent)] | ||
1255 | pub struct FloatNumber { | ||
1256 | pub(crate) syntax: SyntaxNode, | ||
1257 | } | ||
1258 | unsafe impl TransparentNewType for FloatNumber { | ||
1259 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1260 | } | ||
1261 | |||
1262 | impl AstNode for FloatNumber { | ||
1263 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1264 | match syntax.kind() { | ||
1265 | FLOAT_NUMBER => Some(FloatNumber::from_repr(syntax.into_repr())), | ||
1266 | _ => None, | ||
1267 | } | ||
1268 | } | ||
1269 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1270 | } | ||
1271 | |||
1272 | impl ToOwned for FloatNumber { | ||
1273 | type Owned = TreeArc<FloatNumber>; | ||
1274 | fn to_owned(&self) -> TreeArc<FloatNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1275 | } | ||
1276 | |||
1277 | |||
1278 | impl ast::AstToken for FloatNumber {} | ||
1279 | impl FloatNumber {} | ||
1280 | |||
1281 | // FnDef | 1107 | // FnDef |
1282 | #[derive(Debug, PartialEq, Eq, Hash)] | 1108 | #[derive(Debug, PartialEq, Eq, Hash)] |
1283 | #[repr(transparent)] | 1109 | #[repr(transparent)] |
@@ -1613,35 +1439,6 @@ impl ToOwned for IndexExpr { | |||
1613 | 1439 | ||
1614 | impl IndexExpr {} | 1440 | impl IndexExpr {} |
1615 | 1441 | ||
1616 | // IntNumber | ||
1617 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1618 | #[repr(transparent)] | ||
1619 | pub struct IntNumber { | ||
1620 | pub(crate) syntax: SyntaxNode, | ||
1621 | } | ||
1622 | unsafe impl TransparentNewType for IntNumber { | ||
1623 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1624 | } | ||
1625 | |||
1626 | impl AstNode for IntNumber { | ||
1627 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1628 | match syntax.kind() { | ||
1629 | INT_NUMBER => Some(IntNumber::from_repr(syntax.into_repr())), | ||
1630 | _ => None, | ||
1631 | } | ||
1632 | } | ||
1633 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1634 | } | ||
1635 | |||
1636 | impl ToOwned for IntNumber { | ||
1637 | type Owned = TreeArc<IntNumber>; | ||
1638 | fn to_owned(&self) -> TreeArc<IntNumber> { TreeArc::cast(self.syntax.to_owned()) } | ||
1639 | } | ||
1640 | |||
1641 | |||
1642 | impl ast::AstToken for IntNumber {} | ||
1643 | impl IntNumber {} | ||
1644 | |||
1645 | // ItemList | 1442 | // ItemList |
1646 | #[derive(Debug, PartialEq, Eq, Hash)] | 1443 | #[derive(Debug, PartialEq, Eq, Hash)] |
1647 | #[repr(transparent)] | 1444 | #[repr(transparent)] |
@@ -1777,35 +1574,6 @@ impl LetStmt { | |||
1777 | } | 1574 | } |
1778 | } | 1575 | } |
1779 | 1576 | ||
1780 | // Lifetime | ||
1781 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1782 | #[repr(transparent)] | ||
1783 | pub struct Lifetime { | ||
1784 | pub(crate) syntax: SyntaxNode, | ||
1785 | } | ||
1786 | unsafe impl TransparentNewType for Lifetime { | ||
1787 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1788 | } | ||
1789 | |||
1790 | impl AstNode for Lifetime { | ||
1791 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1792 | match syntax.kind() { | ||
1793 | LIFETIME => Some(Lifetime::from_repr(syntax.into_repr())), | ||
1794 | _ => None, | ||
1795 | } | ||
1796 | } | ||
1797 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1798 | } | ||
1799 | |||
1800 | impl ToOwned for Lifetime { | ||
1801 | type Owned = TreeArc<Lifetime>; | ||
1802 | fn to_owned(&self) -> TreeArc<Lifetime> { TreeArc::cast(self.syntax.to_owned()) } | ||
1803 | } | ||
1804 | |||
1805 | |||
1806 | impl ast::AstToken for Lifetime {} | ||
1807 | impl Lifetime {} | ||
1808 | |||
1809 | // LifetimeArg | 1577 | // LifetimeArg |
1810 | #[derive(Debug, PartialEq, Eq, Hash)] | 1578 | #[derive(Debug, PartialEq, Eq, Hash)] |
1811 | #[repr(transparent)] | 1579 | #[repr(transparent)] |
@@ -1832,11 +1600,7 @@ impl ToOwned for LifetimeArg { | |||
1832 | } | 1600 | } |
1833 | 1601 | ||
1834 | 1602 | ||
1835 | impl LifetimeArg { | 1603 | impl LifetimeArg {} |
1836 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1837 | super::child_opt(self) | ||
1838 | } | ||
1839 | } | ||
1840 | 1604 | ||
1841 | // LifetimeParam | 1605 | // LifetimeParam |
1842 | #[derive(Debug, PartialEq, Eq, Hash)] | 1606 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1865,11 +1629,7 @@ impl ToOwned for LifetimeParam { | |||
1865 | 1629 | ||
1866 | 1630 | ||
1867 | impl ast::AttrsOwner for LifetimeParam {} | 1631 | impl ast::AttrsOwner for LifetimeParam {} |
1868 | impl LifetimeParam { | 1632 | impl LifetimeParam {} |
1869 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
1870 | super::child_opt(self) | ||
1871 | } | ||
1872 | } | ||
1873 | 1633 | ||
1874 | // Literal | 1634 | // Literal |
1875 | #[derive(Debug, PartialEq, Eq, Hash)] | 1635 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -1897,130 +1657,7 @@ impl ToOwned for Literal { | |||
1897 | } | 1657 | } |
1898 | 1658 | ||
1899 | 1659 | ||
1900 | impl Literal { | 1660 | impl Literal {} |
1901 | pub fn literal_expr(&self) -> Option<&LiteralExpr> { | ||
1902 | super::child_opt(self) | ||
1903 | } | ||
1904 | } | ||
1905 | |||
1906 | // LiteralExpr | ||
1907 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1908 | #[repr(transparent)] | ||
1909 | pub struct LiteralExpr { | ||
1910 | pub(crate) syntax: SyntaxNode, | ||
1911 | } | ||
1912 | unsafe impl TransparentNewType for LiteralExpr { | ||
1913 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1914 | } | ||
1915 | |||
1916 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
1917 | pub enum LiteralExprKind<'a> { | ||
1918 | String(&'a String), | ||
1919 | ByteString(&'a ByteString), | ||
1920 | RawString(&'a RawString), | ||
1921 | RawByteString(&'a RawByteString), | ||
1922 | Char(&'a Char), | ||
1923 | Byte(&'a Byte), | ||
1924 | IntNumber(&'a IntNumber), | ||
1925 | FloatNumber(&'a FloatNumber), | ||
1926 | TrueKw(&'a TrueKw), | ||
1927 | FalseKw(&'a FalseKw), | ||
1928 | } | ||
1929 | impl<'a> From<&'a String> for &'a LiteralExpr { | ||
1930 | fn from(n: &'a String) -> &'a LiteralExpr { | ||
1931 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1932 | } | ||
1933 | } | ||
1934 | impl<'a> From<&'a ByteString> for &'a LiteralExpr { | ||
1935 | fn from(n: &'a ByteString) -> &'a LiteralExpr { | ||
1936 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1937 | } | ||
1938 | } | ||
1939 | impl<'a> From<&'a RawString> for &'a LiteralExpr { | ||
1940 | fn from(n: &'a RawString) -> &'a LiteralExpr { | ||
1941 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1942 | } | ||
1943 | } | ||
1944 | impl<'a> From<&'a RawByteString> for &'a LiteralExpr { | ||
1945 | fn from(n: &'a RawByteString) -> &'a LiteralExpr { | ||
1946 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1947 | } | ||
1948 | } | ||
1949 | impl<'a> From<&'a Char> for &'a LiteralExpr { | ||
1950 | fn from(n: &'a Char) -> &'a LiteralExpr { | ||
1951 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1952 | } | ||
1953 | } | ||
1954 | impl<'a> From<&'a Byte> for &'a LiteralExpr { | ||
1955 | fn from(n: &'a Byte) -> &'a LiteralExpr { | ||
1956 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1957 | } | ||
1958 | } | ||
1959 | impl<'a> From<&'a IntNumber> for &'a LiteralExpr { | ||
1960 | fn from(n: &'a IntNumber) -> &'a LiteralExpr { | ||
1961 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1962 | } | ||
1963 | } | ||
1964 | impl<'a> From<&'a FloatNumber> for &'a LiteralExpr { | ||
1965 | fn from(n: &'a FloatNumber) -> &'a LiteralExpr { | ||
1966 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1967 | } | ||
1968 | } | ||
1969 | impl<'a> From<&'a TrueKw> for &'a LiteralExpr { | ||
1970 | fn from(n: &'a TrueKw) -> &'a LiteralExpr { | ||
1971 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1972 | } | ||
1973 | } | ||
1974 | impl<'a> From<&'a FalseKw> for &'a LiteralExpr { | ||
1975 | fn from(n: &'a FalseKw) -> &'a LiteralExpr { | ||
1976 | LiteralExpr::cast(&n.syntax).unwrap() | ||
1977 | } | ||
1978 | } | ||
1979 | |||
1980 | |||
1981 | impl AstNode for LiteralExpr { | ||
1982 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1983 | match syntax.kind() { | ||
1984 | | STRING | ||
1985 | | BYTE_STRING | ||
1986 | | RAW_STRING | ||
1987 | | RAW_BYTE_STRING | ||
1988 | | CHAR | ||
1989 | | BYTE | ||
1990 | | INT_NUMBER | ||
1991 | | FLOAT_NUMBER | ||
1992 | | TRUE_KW | ||
1993 | | FALSE_KW => Some(LiteralExpr::from_repr(syntax.into_repr())), | ||
1994 | _ => None, | ||
1995 | } | ||
1996 | } | ||
1997 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1998 | } | ||
1999 | |||
2000 | impl ToOwned for LiteralExpr { | ||
2001 | type Owned = TreeArc<LiteralExpr>; | ||
2002 | fn to_owned(&self) -> TreeArc<LiteralExpr> { TreeArc::cast(self.syntax.to_owned()) } | ||
2003 | } | ||
2004 | |||
2005 | impl LiteralExpr { | ||
2006 | pub fn kind(&self) -> LiteralExprKind { | ||
2007 | match self.syntax.kind() { | ||
2008 | STRING => LiteralExprKind::String(String::cast(&self.syntax).unwrap()), | ||
2009 | BYTE_STRING => LiteralExprKind::ByteString(ByteString::cast(&self.syntax).unwrap()), | ||
2010 | RAW_STRING => LiteralExprKind::RawString(RawString::cast(&self.syntax).unwrap()), | ||
2011 | RAW_BYTE_STRING => LiteralExprKind::RawByteString(RawByteString::cast(&self.syntax).unwrap()), | ||
2012 | CHAR => LiteralExprKind::Char(Char::cast(&self.syntax).unwrap()), | ||
2013 | BYTE => LiteralExprKind::Byte(Byte::cast(&self.syntax).unwrap()), | ||
2014 | INT_NUMBER => LiteralExprKind::IntNumber(IntNumber::cast(&self.syntax).unwrap()), | ||
2015 | FLOAT_NUMBER => LiteralExprKind::FloatNumber(FloatNumber::cast(&self.syntax).unwrap()), | ||
2016 | TRUE_KW => LiteralExprKind::TrueKw(TrueKw::cast(&self.syntax).unwrap()), | ||
2017 | FALSE_KW => LiteralExprKind::FalseKw(FalseKw::cast(&self.syntax).unwrap()), | ||
2018 | _ => unreachable!(), | ||
2019 | } | ||
2020 | } | ||
2021 | } | ||
2022 | |||
2023 | impl LiteralExpr {} | ||
2024 | 1661 | ||
2025 | // LiteralPat | 1662 | // LiteralPat |
2026 | #[derive(Debug, PartialEq, Eq, Hash)] | 1663 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3404,64 +3041,6 @@ impl ToOwned for RangePat { | |||
3404 | 3041 | ||
3405 | impl RangePat {} | 3042 | impl RangePat {} |
3406 | 3043 | ||
3407 | // RawByteString | ||
3408 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3409 | #[repr(transparent)] | ||
3410 | pub struct RawByteString { | ||
3411 | pub(crate) syntax: SyntaxNode, | ||
3412 | } | ||
3413 | unsafe impl TransparentNewType for RawByteString { | ||
3414 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3415 | } | ||
3416 | |||
3417 | impl AstNode for RawByteString { | ||
3418 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3419 | match syntax.kind() { | ||
3420 | RAW_BYTE_STRING => Some(RawByteString::from_repr(syntax.into_repr())), | ||
3421 | _ => None, | ||
3422 | } | ||
3423 | } | ||
3424 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3425 | } | ||
3426 | |||
3427 | impl ToOwned for RawByteString { | ||
3428 | type Owned = TreeArc<RawByteString>; | ||
3429 | fn to_owned(&self) -> TreeArc<RawByteString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3430 | } | ||
3431 | |||
3432 | |||
3433 | impl ast::AstToken for RawByteString {} | ||
3434 | impl RawByteString {} | ||
3435 | |||
3436 | // RawString | ||
3437 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3438 | #[repr(transparent)] | ||
3439 | pub struct RawString { | ||
3440 | pub(crate) syntax: SyntaxNode, | ||
3441 | } | ||
3442 | unsafe impl TransparentNewType for RawString { | ||
3443 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3444 | } | ||
3445 | |||
3446 | impl AstNode for RawString { | ||
3447 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3448 | match syntax.kind() { | ||
3449 | RAW_STRING => Some(RawString::from_repr(syntax.into_repr())), | ||
3450 | _ => None, | ||
3451 | } | ||
3452 | } | ||
3453 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3454 | } | ||
3455 | |||
3456 | impl ToOwned for RawString { | ||
3457 | type Owned = TreeArc<RawString>; | ||
3458 | fn to_owned(&self) -> TreeArc<RawString> { TreeArc::cast(self.syntax.to_owned()) } | ||
3459 | } | ||
3460 | |||
3461 | |||
3462 | impl ast::AstToken for RawString {} | ||
3463 | impl RawString {} | ||
3464 | |||
3465 | // RefExpr | 3044 | // RefExpr |
3466 | #[derive(Debug, PartialEq, Eq, Hash)] | 3045 | #[derive(Debug, PartialEq, Eq, Hash)] |
3467 | #[repr(transparent)] | 3046 | #[repr(transparent)] |
@@ -3622,34 +3201,6 @@ impl ReturnExpr { | |||
3622 | } | 3201 | } |
3623 | } | 3202 | } |
3624 | 3203 | ||
3625 | // SelfKw | ||
3626 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3627 | #[repr(transparent)] | ||
3628 | pub struct SelfKw { | ||
3629 | pub(crate) syntax: SyntaxNode, | ||
3630 | } | ||
3631 | unsafe impl TransparentNewType for SelfKw { | ||
3632 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3633 | } | ||
3634 | |||
3635 | impl AstNode for SelfKw { | ||
3636 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3637 | match syntax.kind() { | ||
3638 | SELF_KW => Some(SelfKw::from_repr(syntax.into_repr())), | ||
3639 | _ => None, | ||
3640 | } | ||
3641 | } | ||
3642 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3643 | } | ||
3644 | |||
3645 | impl ToOwned for SelfKw { | ||
3646 | type Owned = TreeArc<SelfKw>; | ||
3647 | fn to_owned(&self) -> TreeArc<SelfKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
3648 | } | ||
3649 | |||
3650 | |||
3651 | impl SelfKw {} | ||
3652 | |||
3653 | // SelfParam | 3204 | // SelfParam |
3654 | #[derive(Debug, PartialEq, Eq, Hash)] | 3205 | #[derive(Debug, PartialEq, Eq, Hash)] |
3655 | #[repr(transparent)] | 3206 | #[repr(transparent)] |
@@ -3677,11 +3228,7 @@ impl ToOwned for SelfParam { | |||
3677 | 3228 | ||
3678 | 3229 | ||
3679 | impl ast::TypeAscriptionOwner for SelfParam {} | 3230 | impl ast::TypeAscriptionOwner for SelfParam {} |
3680 | impl SelfParam { | 3231 | impl SelfParam {} |
3681 | pub fn self_kw(&self) -> Option<&SelfKw> { | ||
3682 | super::child_opt(self) | ||
3683 | } | ||
3684 | } | ||
3685 | 3232 | ||
3686 | // SlicePat | 3233 | // SlicePat |
3687 | #[derive(Debug, PartialEq, Eq, Hash)] | 3234 | #[derive(Debug, PartialEq, Eq, Hash)] |
@@ -3866,35 +3413,6 @@ impl Stmt { | |||
3866 | 3413 | ||
3867 | impl Stmt {} | 3414 | impl Stmt {} |
3868 | 3415 | ||
3869 | // String | ||
3870 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
3871 | #[repr(transparent)] | ||
3872 | pub struct String { | ||
3873 | pub(crate) syntax: SyntaxNode, | ||
3874 | } | ||
3875 | unsafe impl TransparentNewType for String { | ||
3876 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
3877 | } | ||
3878 | |||
3879 | impl AstNode for String { | ||
3880 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
3881 | match syntax.kind() { | ||
3882 | STRING => Some(String::from_repr(syntax.into_repr())), | ||
3883 | _ => None, | ||
3884 | } | ||
3885 | } | ||
3886 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
3887 | } | ||
3888 | |||
3889 | impl ToOwned for String { | ||
3890 | type Owned = TreeArc<String>; | ||
3891 | fn to_owned(&self) -> TreeArc<String> { TreeArc::cast(self.syntax.to_owned()) } | ||
3892 | } | ||
3893 | |||
3894 | |||
3895 | impl ast::AstToken for String {} | ||
3896 | impl String {} | ||
3897 | |||
3898 | // StructDef | 3416 | // StructDef |
3899 | #[derive(Debug, PartialEq, Eq, Hash)] | 3417 | #[derive(Debug, PartialEq, Eq, Hash)] |
3900 | #[repr(transparent)] | 3418 | #[repr(transparent)] |
@@ -4070,35 +3588,6 @@ impl TraitDef { | |||
4070 | } | 3588 | } |
4071 | } | 3589 | } |
4072 | 3590 | ||
4073 | // TrueKw | ||
4074 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
4075 | #[repr(transparent)] | ||
4076 | pub struct TrueKw { | ||
4077 | pub(crate) syntax: SyntaxNode, | ||
4078 | } | ||
4079 | unsafe impl TransparentNewType for TrueKw { | ||
4080 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
4081 | } | ||
4082 | |||
4083 | impl AstNode for TrueKw { | ||
4084 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
4085 | match syntax.kind() { | ||
4086 | TRUE_KW => Some(TrueKw::from_repr(syntax.into_repr())), | ||
4087 | _ => None, | ||
4088 | } | ||
4089 | } | ||
4090 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
4091 | } | ||
4092 | |||
4093 | impl ToOwned for TrueKw { | ||
4094 | type Owned = TreeArc<TrueKw>; | ||
4095 | fn to_owned(&self) -> TreeArc<TrueKw> { TreeArc::cast(self.syntax.to_owned()) } | ||
4096 | } | ||
4097 | |||
4098 | |||
4099 | impl ast::AstToken for TrueKw {} | ||
4100 | impl TrueKw {} | ||
4101 | |||
4102 | // TryExpr | 3591 | // TryExpr |
4103 | #[derive(Debug, PartialEq, Eq, Hash)] | 3592 | #[derive(Debug, PartialEq, Eq, Hash)] |
4104 | #[repr(transparent)] | 3593 | #[repr(transparent)] |
@@ -4403,10 +3892,6 @@ impl TypeBound { | |||
4403 | pub fn type_ref(&self) -> Option<&TypeRef> { | 3892 | pub fn type_ref(&self) -> Option<&TypeRef> { |
4404 | super::child_opt(self) | 3893 | super::child_opt(self) |
4405 | } | 3894 | } |
4406 | |||
4407 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
4408 | super::child_opt(self) | ||
4409 | } | ||
4410 | } | 3895 | } |
4411 | 3896 | ||
4412 | // TypeBoundList | 3897 | // TypeBoundList |
@@ -4847,10 +4332,6 @@ impl WherePred { | |||
4847 | pub fn type_ref(&self) -> Option<&TypeRef> { | 4332 | pub fn type_ref(&self) -> Option<&TypeRef> { |
4848 | super::child_opt(self) | 4333 | super::child_opt(self) |
4849 | } | 4334 | } |
4850 | |||
4851 | pub fn lifetime(&self) -> Option<&Lifetime> { | ||
4852 | super::child_opt(self) | ||
4853 | } | ||
4854 | } | 4335 | } |
4855 | 4336 | ||
4856 | // WhileExpr | 4337 | // WhileExpr |