diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 60314d245..256277609 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -1821,6 +1821,38 @@ impl LiteralExpr { | |||
1821 | 1821 | ||
1822 | impl LiteralExpr {} | 1822 | impl LiteralExpr {} |
1823 | 1823 | ||
1824 | // LiteralPat | ||
1825 | #[derive(Debug, PartialEq, Eq, Hash)] | ||
1826 | #[repr(transparent)] | ||
1827 | pub struct LiteralPat { | ||
1828 | pub(crate) syntax: SyntaxNode, | ||
1829 | } | ||
1830 | unsafe impl TransparentNewType for LiteralPat { | ||
1831 | type Repr = rowan::SyntaxNode<RaTypes>; | ||
1832 | } | ||
1833 | |||
1834 | impl AstNode for LiteralPat { | ||
1835 | fn cast(syntax: &SyntaxNode) -> Option<&Self> { | ||
1836 | match syntax.kind() { | ||
1837 | LITERAL_PAT => Some(LiteralPat::from_repr(syntax.into_repr())), | ||
1838 | _ => None, | ||
1839 | } | ||
1840 | } | ||
1841 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1842 | } | ||
1843 | |||
1844 | impl ToOwned for LiteralPat { | ||
1845 | type Owned = TreeArc<LiteralPat>; | ||
1846 | fn to_owned(&self) -> TreeArc<LiteralPat> { TreeArc::cast(self.syntax.to_owned()) } | ||
1847 | } | ||
1848 | |||
1849 | |||
1850 | impl LiteralPat { | ||
1851 | pub fn literal(&self) -> Option<&Literal> { | ||
1852 | super::child_opt(self) | ||
1853 | } | ||
1854 | } | ||
1855 | |||
1824 | // LoopExpr | 1856 | // LoopExpr |
1825 | #[derive(Debug, PartialEq, Eq, Hash)] | 1857 | #[derive(Debug, PartialEq, Eq, Hash)] |
1826 | #[repr(transparent)] | 1858 | #[repr(transparent)] |
@@ -2594,6 +2626,7 @@ pub enum PatKind<'a> { | |||
2594 | TuplePat(&'a TuplePat), | 2626 | TuplePat(&'a TuplePat), |
2595 | SlicePat(&'a SlicePat), | 2627 | SlicePat(&'a SlicePat), |
2596 | RangePat(&'a RangePat), | 2628 | RangePat(&'a RangePat), |
2629 | LiteralPat(&'a LiteralPat), | ||
2597 | } | 2630 | } |
2598 | 2631 | ||
2599 | impl AstNode for Pat { | 2632 | impl AstNode for Pat { |
@@ -2607,7 +2640,8 @@ impl AstNode for Pat { | |||
2607 | | TUPLE_STRUCT_PAT | 2640 | | TUPLE_STRUCT_PAT |
2608 | | TUPLE_PAT | 2641 | | TUPLE_PAT |
2609 | | SLICE_PAT | 2642 | | SLICE_PAT |
2610 | | RANGE_PAT => Some(Pat::from_repr(syntax.into_repr())), | 2643 | | RANGE_PAT |
2644 | | LITERAL_PAT => Some(Pat::from_repr(syntax.into_repr())), | ||
2611 | _ => None, | 2645 | _ => None, |
2612 | } | 2646 | } |
2613 | } | 2647 | } |
@@ -2631,6 +2665,7 @@ impl Pat { | |||
2631 | TUPLE_PAT => PatKind::TuplePat(TuplePat::cast(&self.syntax).unwrap()), | 2665 | TUPLE_PAT => PatKind::TuplePat(TuplePat::cast(&self.syntax).unwrap()), |
2632 | SLICE_PAT => PatKind::SlicePat(SlicePat::cast(&self.syntax).unwrap()), | 2666 | SLICE_PAT => PatKind::SlicePat(SlicePat::cast(&self.syntax).unwrap()), |
2633 | RANGE_PAT => PatKind::RangePat(RangePat::cast(&self.syntax).unwrap()), | 2667 | RANGE_PAT => PatKind::RangePat(RangePat::cast(&self.syntax).unwrap()), |
2668 | LITERAL_PAT => PatKind::LiteralPat(LiteralPat::cast(&self.syntax).unwrap()), | ||
2634 | _ => unreachable!(), | 2669 | _ => unreachable!(), |
2635 | } | 2670 | } |
2636 | } | 2671 | } |