aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs66
1 files changed, 66 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 29a7ce166..fae371509 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1771,6 +1771,72 @@ impl MacroCall {
1771 } 1771 }
1772} 1772}
1773 1773
1774// MacroItems
1775#[derive(Debug, PartialEq, Eq, Hash)]
1776#[repr(transparent)]
1777pub struct MacroItems {
1778 pub(crate) syntax: SyntaxNode,
1779}
1780unsafe impl TransparentNewType for MacroItems {
1781 type Repr = rowan::SyntaxNode;
1782}
1783
1784impl AstNode for MacroItems {
1785 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1786 match syntax.kind() {
1787 MACRO_ITEMS => Some(MacroItems::from_repr(syntax.into_repr())),
1788 _ => None,
1789 }
1790 }
1791 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1792}
1793
1794impl ToOwned for MacroItems {
1795 type Owned = TreeArc<MacroItems>;
1796 fn to_owned(&self) -> TreeArc<MacroItems> { TreeArc::cast(self.syntax.to_owned()) }
1797}
1798
1799
1800impl ast::ModuleItemOwner for MacroItems {}
1801impl ast::FnDefOwner for MacroItems {}
1802impl MacroItems {}
1803
1804// MacroStmts
1805#[derive(Debug, PartialEq, Eq, Hash)]
1806#[repr(transparent)]
1807pub struct MacroStmts {
1808 pub(crate) syntax: SyntaxNode,
1809}
1810unsafe impl TransparentNewType for MacroStmts {
1811 type Repr = rowan::SyntaxNode;
1812}
1813
1814impl AstNode for MacroStmts {
1815 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1816 match syntax.kind() {
1817 MACRO_STMTS => Some(MacroStmts::from_repr(syntax.into_repr())),
1818 _ => None,
1819 }
1820 }
1821 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1822}
1823
1824impl ToOwned for MacroStmts {
1825 type Owned = TreeArc<MacroStmts>;
1826 fn to_owned(&self) -> TreeArc<MacroStmts> { TreeArc::cast(self.syntax.to_owned()) }
1827}
1828
1829
1830impl MacroStmts {
1831 pub fn statements(&self) -> impl Iterator<Item = &Stmt> {
1832 super::children(self)
1833 }
1834
1835 pub fn expr(&self) -> Option<&Expr> {
1836 super::child_opt(self)
1837 }
1838}
1839
1774// MatchArm 1840// MatchArm
1775#[derive(Debug, PartialEq, Eq, Hash)] 1841#[derive(Debug, PartialEq, Eq, Hash)]
1776#[repr(transparent)] 1842#[repr(transparent)]